CLASIFICACION DE PROYECTO
Enviado por Mίlεƞα ƘαƦεƞ ♥ • 10 de Agosto de 2015 • Documentos de Investigación • 364 Palabras (2 Páginas) • 162 Visitas
package encapsulamiento;
public class Engineer {
private String fname;
private String lname;
private double salary;
public String getFname(){
return this.fname;
}
Public String getLname(){
return this.lname;
}
public int getSalary(){
return this.getSalary();
}
public void SetFname (String fname){
this.fname= fname;
}
public void SetLname(String lname){
this.lname= lname;
}
public void SetSalary(double Salary){
this.salary=salary;
}
}
ENCAPSULAMIENTO.JAVA
package encapsulamiento;
public class Encapsulamiento {
public static void main(String[] args) {
//vamos a crear un objeto instaciando
//la clase Enginner
Engineer ingeniero1=new Engineer();
ingeniero1.setfname("María");
ingeniero1.setlname("Silva rojas");
ingeniero1.setsalary(1000000.00);
System.out.println("nombre: "+ingeniero1.getFname());
System.out.println("apellidos: "+ingeniero1.getLname());
System.out.println("Salario: "+ingeniero1.getSalary());
}
}
HERENCIA
EMPLOYEE.JAVA
package herencia;
public class employee {
private String fname;
private String lname;
private double salary;
public String getFname(){
return this.fname;
}
public String getLname(){
return this.lname;
}
public double getSalary(){
return this.salary;
}
public void incrementarSalario(int incrementarSalario){
this.salary=this.salary+incrementarSalario;
System.out.println("nuevo Salario : "+ this.salary);
}
public void setFname(String fname){
this.fname=fname;
}
public void setLname(String lname){
this.lname=lname;
}
...