Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Family
- {
- private String name;
- private int adults;
- private int teenagers;
- private int child;
- private double income;
- private int members;
- public Family(String name,int members,double income)
- {
- this.name = name;
- this.income = income;
- this.members = members;
- }
- public double WaterBill()
- {
- return this.adults * 1 + this.teenagers * 0.7 + this.child * 0.5;
- }
- public String incomeCompared(double avgIncome)
- {
- if(this.income > avgIncome)
- {
- return "Above average";
- }
- else if(this.income < avgIncome)
- {
- return "Below average";
- }
- else
- {
- return "average";
- }
- }
- public void barMitzva()
- {
- this.child -= 1;
- this.teenagers += 1;
- }
- public void Ezrahut()
- {
- this.teenagers -=1;
- this.adults +=1;
- }
- public int getAdults()
- {
- return adults;
- }
- public void setAdults(int adults)
- {
- this.adults = adults;
- }
- public int getTeenagers()
- {
- return teenagers;
- }
- public void setTeenagers(int teenagers)
- {
- this.teenagers = teenagers;
- }
- public int getChild()
- {
- return child;
- }
- public void setChild(int child)
- {
- this.child = child;
- }
- public double getIncome()
- {
- return income;
- }
- public void setIncome(double income)
- {
- this.income = income;
- }
- public int getMembers()
- {
- return this.members;
- }
- public void setMembers(int members)
- {
- this.members = members;
- }
- }
Add Comment
Please, Sign In to add comment