pretty simple lab just an abstract clubmember with 2 classes that extend it:
public abstract class ClubMember{ private int memNumb; private String memName; public ClubMember(String name, int number){ memNumb=number; memName=name; } public abstract double getAnnualFee(); public int getMemberNum(){ return memNumb; } public String getName(){ return memName; } }
public class SilverMember extends ClubMember{ private int memCar; public static final double PER_CAR_FEE = 1000; public static final double SILVER_FEE = 3000; public SilverMember(String name,int number,int carnumb){ super(name,number); memCar=carnumb; } public double getAnnualFee(){ return SILVER_FEE+memCar*PER_CAR_FEE; } }
public class BronzeMember extends ClubMember{ public BronzeMember(String name, int number){ super(name,number); } public static final double BRONZE_FEE = 1000; public double getAnnualFee(){ return BRONZE_FEE; } }
1 comment:
pretty simple lab just an abstract clubmember with 2 classes that extend it:
public abstract class ClubMember{
private int memNumb;
private String memName;
public ClubMember(String name, int number){
memNumb=number;
memName=name;
}
public abstract double getAnnualFee();
public int getMemberNum(){
return memNumb;
}
public String getName(){
return memName;
}
}
public class SilverMember extends ClubMember{
private int memCar;
public static final double PER_CAR_FEE = 1000;
public static final double SILVER_FEE = 3000;
public SilverMember(String name,int number,int carnumb){
super(name,number);
memCar=carnumb;
}
public double getAnnualFee(){
return SILVER_FEE+memCar*PER_CAR_FEE;
}
}
public class BronzeMember extends ClubMember{
public BronzeMember(String name, int number){
super(name,number);
}
public static final double BRONZE_FEE = 1000;
public double getAnnualFee(){
return BRONZE_FEE;
}
}
Thanks for the notes again
Post a Comment