Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TurtleGraphics;
- public class packet3exercise15h
- {
- public static void main(String[] args)
- {
- KeyboardReader reader = new KeyboardReader();
- double food, clothing, entertainment, rent;
- double prebt, pent, pcloth, pfood;
- System.out.println("How much money do you spend on clothes");
- clothing = reader.readInt();
- System.out.println("How much money do you spend on rent");
- rent = reader.readInt();
- System.out.println("How much money do you spend on food");
- food = reader.readInt();
- System.out.println("How much money do you spend on entertainment");
- entertainment = reader.readInt();
- double total = food + clothing + entertainment + rent;
- //Percents
- prebt = rent/(food + clothing + entertainment + rent) * 100;
- pfood = food/(food + clothing + entertainment + rent) * 100;
- pent = rent/(food + clothing + entertainment + rent) * 100;
- pcloth = clothing/(food + clothing + entertainment + rent) * 100;
- System.out.println("" + pfood + " Percent on food");
- System.out.println("" + pent + " Percent on entertainment");
- System.out.println("" + pcloth + " Percent on clothing");
- System.out.println("" + prebt + " Percent on rent");
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement