Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Serhat Tas
- //Period 4
- import java.util.*;
- public class Paint
- {
- public static void main (String args[])
- {
- Scanner readernum=new Scanner (System.in);
- Scanner reader = new Scanner(System.in);
- double length;
- double width;
- double height;
- double premiumpaint=30.98;
- double regularpaint=18.97;
- String a = "Enter the length of the room:";
- System.out.print(a);
- length=readernum.nextDouble();
- String b = "Enter the width of the room:";
- System.out.print(b);
- width=readernum.nextDouble();
- String c="Enter the height of the room:";
- System.out.print(c);
- height=readernum.nextDouble();
- String e=("Regular or premium (r or p)? ");
- System.out.print(e);
- e=reader.nextLine();
- if (e.equals("r"));
- {
- String ceiling=("Paint the ceiling? y or n:");
- System.out.print(ceiling);
- ceiling=reader.nextLine();
- if (ceiling.equals("y"))
- {
- ceiling=reader.nextLine();
- double math= ((((height + width)*2) + ((height + length)*2) + ((height + length))/250));
- double total = (Math.round((math/regularpaint)));
- double gallons = (Math.round(math));
- System.out.println("Gallons of paint needed:" + gallons + " Total cost of paint:" + total + "$");
- }
- else if(ceiling.equals("n"))
- {
- double mathi= (((height + width)*2) + (((height + length)*2)/250));
- double totali = (Math.round((mathi/regularpaint)));
- double gallonsi = (Math.round(mathi));
- System.out.println("Gallons of paint needed:" + gallonsi + " Total cost of paint:" + totali + "$");
- }
- else if(e.equals("p"));
- {
- String roof = ("Paint the ceiling? y or n:");
- System.out.print(roof);
- roof=reader.nextLine();
- if (roof.equals("y"))
- {
- roof=reader.nextLine();
- double mathii= ((((height + width)*2) + ((height + length)*2) + ((height + length))/250));
- double totalii = (Math.round((mathii/premiumpaint)));
- double gallonsii = (Math.round(mathii));
- System.out.println("Gallons of paint needed:" + gallonsii + " Total cost of paint:" + totalii + "$");
- }
- else if(ceiling.equals("n"))
- {
- double mathiii= (((height + width)*2) + (((height + length)*2)/250));
- double totaliii = (Math.round((mathiii/premiumpaint)));
- double gallonsiii = (Math.round(mathiii));
- System.out.println("Gallons of paint needed:" + gallonsiii + " Total cost of paint:" + totaliii + "$");
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment