Guest User

Untitled

a guest
Dec 16th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Serhat Tas
  2. //Period 4
  3.    import java.util.*;
  4.     public class Paint
  5.    {
  6.        public static void main (String args[])
  7.       {
  8.          Scanner readernum=new Scanner (System.in);
  9.          Scanner reader = new Scanner(System.in);
  10.          double length;
  11.          double width;
  12.          double height;
  13.          double premiumpaint=30.98;
  14.          double regularpaint=18.97;
  15.          String a = "Enter the length of the room:";
  16.          System.out.print(a);
  17.          length=readernum.nextDouble();
  18.          String b = "Enter the width of the room:";
  19.          System.out.print(b);
  20.          width=readernum.nextDouble();
  21.          String c="Enter the height of the room:";
  22.          System.out.print(c);
  23.          height=readernum.nextDouble();
  24.          String e=("Regular or premium (r or p)? ");
  25.          System.out.print(e);
  26.          e=reader.nextLine();
  27.          if (e.equals("r"));
  28.          {
  29.             String ceiling=("Paint the ceiling? y or n:");
  30.             System.out.print(ceiling);
  31.             ceiling=reader.nextLine();
  32.          
  33.          
  34.             if (ceiling.equals("y"))
  35.             {
  36.                ceiling=reader.nextLine();
  37.                double math= ((((height + width)*2) + ((height + length)*2) + ((height + length))/250));
  38.                double total = (Math.round((math/regularpaint)));
  39.                double gallons = (Math.round(math));
  40.                System.out.println("Gallons of paint needed:" + gallons + " Total cost of paint:" + total + "$");
  41.             }
  42.             else if(ceiling.equals("n"))
  43.             {          
  44.                double mathi= (((height + width)*2) + (((height + length)*2)/250));
  45.                double totali = (Math.round((mathi/regularpaint)));
  46.                double gallonsi = (Math.round(mathi));
  47.                System.out.println("Gallons of paint needed:" + gallonsi + " Total cost of paint:" + totali + "$");
  48.             }
  49.                
  50.                
  51.             else if(e.equals("p"));
  52.             {
  53.                String roof = ("Paint the ceiling? y or n:");
  54.                System.out.print(roof);
  55.                roof=reader.nextLine();
  56.                            
  57.                if (roof.equals("y"))
  58.                {
  59.                   roof=reader.nextLine();
  60.                   double mathii= ((((height + width)*2) + ((height + length)*2) + ((height + length))/250));
  61.                   double totalii = (Math.round((mathii/premiumpaint)));
  62.                   double gallonsii = (Math.round(mathii));
  63.                   System.out.println("Gallons of paint needed:" + gallonsii + " Total cost of paint:" + totalii + "$");
  64.                }
  65.                else if(ceiling.equals("n"))
  66.                {           
  67.                   double mathiii= (((height + width)*2) + (((height + length)*2)/250));
  68.                   double totaliii = (Math.round((mathiii/premiumpaint)));
  69.                   double gallonsiii = (Math.round(mathiii));
  70.                   System.out.println("Gallons of paint needed:" + gallonsiii + " Total cost of paint:" + totaliii + "$");
  71.                }
  72.             }
  73.          }
  74.       }
  75.    }
Add Comment
Please, Sign In to add comment