Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class Main {
- static Scanner in = new Scanner (System.in);
- public static void main(String[] args)
- {
- System.out.println("Enter family name, Enter how many members and family's income");
- Family porat = new Family(in.nextLine(), in.nextInt(), in.nextDouble());
- for(int i = 0; i < porat.getMembers(); i++)
- {
- System.out.println("Your Age");
- int age = in.nextInt();
- if(age < 12)
- {
- porat.setChild(porat.getChild() + 1);
- }
- else if(age <= 18 && age > 12)
- {
- porat.setTeenagers(porat.getTeenagers() + 1);
- }
- if(age > 18)
- {
- porat.setAdults(porat.getAdults() + 1);
- }
- }
- System.out.println("Children = " + porat.getChild()+ " Teenagers = " + porat.getTeenagers() + " Adults = " + porat.getAdults());
- System.out.println("Enter avg income");
- double homo = in.nextDouble();
- System.out.println(porat.incomeCompared(homo));
- double cheaterHomo = porat.WaterBill();
- if(porat.getIncome() < homo)
- {
- cheaterHomo = (porat.WaterBill()*1.1);
- }
- System.out.println("You Achieved " + porat.WaterBill() + " Favor Points");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement