Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1. package TurtleGraphics;
  2. public class packet3exercise15h
  3. {
  4.     public static void main(String[] args)
  5.     {
  6.         KeyboardReader reader = new KeyboardReader();
  7.         double food, clothing, entertainment, rent;
  8.         double prebt, pent, pcloth, pfood;
  9.         System.out.println("How much money do you spend on clothes");
  10.         clothing = reader.readInt();
  11.         System.out.println("How much money do you spend on rent");
  12.         rent = reader.readInt();
  13.         System.out.println("How much money do you spend on food");
  14.         food = reader.readInt();
  15.         System.out.println("How much money do you spend on entertainment");
  16.         entertainment = reader.readInt();
  17.         double total = food + clothing + entertainment + rent;
  18.         //Percents 
  19.         prebt = rent/(food + clothing + entertainment + rent) * 100;
  20.         pfood = food/(food + clothing + entertainment + rent) * 100;
  21.         pent = rent/(food + clothing + entertainment + rent) * 100;
  22.         pcloth = clothing/(food + clothing + entertainment + rent) * 100;
  23.         System.out.println("" + pfood + " Percent on food");
  24.         System.out.println("" + pent + " Percent on entertainment");
  25.         System.out.println("" + pcloth + " Percent on clothing");
  26.         System.out.println("" + prebt + " Percent on rent");
  27.         // TODO Auto-generated method stub
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement