-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
53 lines (39 loc) · 1.31 KB
/
Main.java
File metadata and controls
53 lines (39 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
public class Main {
public static void main(String[] args) {
Cliente cliente = new Cliente();
cliente.setCredito(5000);
cliente.edad = 60;
cliente.nombre = "Pablo";
cliente.telefono = "3185236458";
System.out.println("El cliente se llama " + cliente.nombre + ", su edad es " + cliente.edad + " años, tiene un credito de " + cliente.getCredito() + " dolares, y su teléfono es " + cliente.telefono);
Trabajador trabajador = new Trabajador();
trabajador.setSalario(2000);
trabajador.edad = 45;
trabajador.nombre = "perejildo";
trabajador.telefono = "3203185498";
System.out.println("El trabajador de llama " + trabajador.nombre + ", su edad es " + trabajador.edad + " años, tiene un salario de " + trabajador.getSalario() + " dolares, y su teléfono es " + trabajador.telefono);
}
}
class Persona {
int edad;
String nombre;
String telefono;
}
class Cliente extends Persona {
private float credito;
public void setCredito(float credito){
this.credito = credito;
}
public float getCredito() {
return this.credito;
}
}
class Trabajador extends Persona {
private float salario;
public void setSalario(float salario){
this.salario = salario;
}
public float getSalario() {
return this.salario;
}
}