Yuvalxp8

Family

Jan 26th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.44 KB | None | 0 0
  1. public class Family
  2. {
  3.     private String name;
  4.     private int adults;
  5.     private int teenagers;
  6.     private int child;
  7.     private double income;
  8.     private int members;
  9.    
  10.     public Family(String name,int members,double income)
  11.     {
  12.     this.name = name;
  13.     this.income = income;
  14.     this.members = members;
  15.     }
  16.  
  17.     public double WaterBill()
  18.     {
  19.         return this.adults * 1 + this.teenagers * 0.7 + this.child * 0.5;
  20.     }
  21.     public String incomeCompared(double avgIncome)
  22.     {
  23.         if(this.income > avgIncome)
  24.         {
  25.             return "Above average";
  26.         }
  27.        
  28.        
  29.         else if(this.income < avgIncome)
  30.         {
  31.             return "Below average";
  32.         }
  33.         else
  34.         {
  35.             return "average";
  36.         }
  37.     }
  38.     public void barMitzva()
  39.     {
  40.         this.child -= 1;
  41.         this.teenagers += 1;
  42.     }
  43.     public void Ezrahut()
  44.     {
  45.         this.teenagers -=1;
  46.         this.adults +=1;
  47.     }
  48.    
  49.    
  50.    
  51.     public int getAdults()
  52.     {
  53.         return adults;
  54.     }
  55.  
  56.     public void setAdults(int adults)
  57.     {
  58.         this.adults = adults;
  59.     }
  60.  
  61.     public int getTeenagers()
  62.     {
  63.         return teenagers;
  64.     }
  65.  
  66.     public void setTeenagers(int teenagers)
  67.     {
  68.         this.teenagers = teenagers;
  69.     }
  70.  
  71.     public int getChild()
  72.     {
  73.         return child;
  74.     }
  75.  
  76.     public void setChild(int child)
  77.     {
  78.         this.child = child;
  79.     }
  80.  
  81.     public double getIncome()
  82.     {
  83.         return income;
  84.     }
  85.  
  86.     public void setIncome(double income)
  87.     {
  88.         this.income = income;
  89.     }
  90.    
  91.     public int getMembers()
  92.     {
  93.         return this.members;
  94.     }
  95.  
  96.     public void setMembers(int members)
  97.     {
  98.         this.members = members;
  99.     }
  100. }
Add Comment
Please, Sign In to add comment