Skip to content

Commit 5fa4637

Browse files
authored
Merge pull request mouredev#5998 from JesusAntonioEEscamilla/JesusAEE
08 - Java & Python
2 parents e75d1ad + 2f98778 commit 5fa4637

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
3+
/** #07 - Java -> Jesus Antonio Escamilla */
4+
5+
public class JesusAntonioEEscamilla {
6+
public static void main(String[] args) {
7+
//---EJERCIÓ---
8+
Persona persona = new Persona("Jesus Antonio", 24, "Programador");
9+
persona.imprimirDetalles();
10+
//---EXTRA---
11+
12+
}
13+
14+
//---EJERCIÓ---
15+
// Definición de la clase Persona
16+
static class Persona {
17+
// Atributos de la clase
18+
private String nombre;
19+
private int edad;
20+
private String ocupacion;
21+
22+
// Constructor de la clase Persona
23+
public Persona(String nombre, int edad, String ocupacion) {
24+
this.nombre = nombre; // Inicializa el atributo nombre
25+
this.edad = edad; // Inicializa el atributo edad
26+
this.ocupacion = ocupacion; // Inicializa el atributo ocupacion
27+
}
28+
29+
// Método para imprimir los atributos de la clase
30+
public void imprimirDetalles() {
31+
System.out.println("Nombre: " + nombre);
32+
System.out.println("Edad: " + edad);
33+
System.out.println("Profesión: " + ocupacion);
34+
}
35+
}
36+
37+
38+
39+
/**-----DIFICULTAD EXTRA-----*/
40+
41+
// Pendiente
42+
43+
/**-----DIFICULTAD EXTRA-----*/
44+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# #08 - Python -> Jesus Antonio Escamilla
2+
3+
"""
4+
EJERCIÓ
5+
"""
6+
# Definición de la clase Persona
7+
class Persona:
8+
# Inicializador con atributos nombre y edad
9+
def __init__(self, nombre, edad, ocupacion):
10+
self.nombre = nombre
11+
self.edad = edad
12+
self.ocupacion = ocupacion
13+
14+
# Método para imprimir los atributos
15+
def imprimir_informacion(self):
16+
print(f"Nombre: {self.nombre}, Edad: {self.edad}, Ocupación: {self.ocupacion}")
17+
18+
# Crear una instancia de la clase Persona
19+
persona1 = Persona("Jesus Antonio", 30, "Programador")
20+
21+
persona1.imprimir_informacion()
22+
23+
24+
25+
"""
26+
EXTRA
27+
"""
28+
# Pendientes

0 commit comments

Comments
 (0)