//abstract class
package employ;
public abstract class Employee {
//filds in class employee
private String name;
private String family;
//sazande
Employee(String name,String family){
setName(name);
setFamily(family);
}
//setName
public void setName(String name){
this.name=name;
}
//setFamily
public void setFamily(String family){
this.family=family;
}
//getName
public String getName(){
return this.name;
}
//getFamily
public String getFamily(){
return this.family;
}
//abstract function
//bedone piyadesazi
public abstract double hoghoogh();
public String toString(){
return name+":"+family;
}
}
//class farzand
package employ;
public class TamamVaght extends Employee{
//filds
private double hooghoghe_mahane;
//sazande
TamamVaght(String name,String family,double hooghoghe_mahane){
super(name,family);
setHoghogheMahane(hooghoghe_mahane);
}
//setHoghoghMahane
public void setHoghogheMahane(double hooghoghe_mahane){
this.hooghoghe_mahane=hooghoghe_mahane;
}
//getHoghoghMahane
public double getHoghoghMahane(){
return this.hooghoghe_mahane;
}
//piyade sazi tabe abstract Employee
@Override
public double hoghoogh(){
return hooghoghe_mahane;
}
public String toString(){
return super.toString()+"::"+this.hooghoghe_mahane;
}
}
//class farzand
package employ;
public class RoozMozd extends Employee {
//filds saate va pool pardakhti b eza yek saat
private double hour;
private double hoghoogh_saati;
//sazande
RoozMozd(String name, String family, double hour, double hoghoogh_saati) {
super(name,family);
this.hour=hour;
this.hoghoogh_saati=hoghoogh_saati;
}
//setHour
public void setHour(double hour){
this.hour=hour;
}
//setHoghooghSaati
public void setHoghooghSaati(double hoghoogh_saati){
this.hoghoogh_saati=hoghoogh_saati;
}
//getHour
public double getHour(){
return this.hour;
}
//getHoghooghSaati
public double getHoghooghSaati(){
return this.hoghoogh_saati;
}
//mohasebaye hooghogh
public double hoghoogh(){
return this.hour*this.hoghoogh_saati;
}
//toString
public String toString(){
return super.toString()+"::"+hoghoogh();
}
}
:: موضوعات مرتبط:
برنامه سازی پیشرفته ,
,
:: برچسبها:
برنامه ,
کلاس ,
abstract ,
Employ ,
:: بازدید از این مطلب : 326
|
امتیاز مطلب : 0
|
تعداد امتیازدهندگان : 0
|
مجموع امتیاز : 0