Advertisement
Guest User

Untitled

a guest
Dec 14th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.87 KB | None | 0 0
  1. public static void main(String[] args) {
  2. int basePrice = 1000, totalPrice = 0,width=0,length=0,numDrawers;
  3.  
  4. //int newTotalPrice = totalPrice;
  5.  
  6. Boolean repeat = true;
  7. Scanner scan= new Scanner(System.in);
  8. Scanner scan2= new Scanner(System.in);
  9. Scanner scan3= new Scanner(System.in);
  10. Scanner scan4 = new Scanner(System.in);
  11.  
  12. while (repeat){
  13. System.out.println("\nDESK PRICE CALCULATOR"+ "\n");
  14. System.out.println("enter width and length of table:");
  15.  
  16. System.out.print(">width: ");
  17. width=scan.nextInt();
  18.  
  19. System.out.print(">length: ");
  20. length=scan.nextInt();
  21.  
  22. int area = width*length;
  23. if (area > 1000){
  24. totalPrice = basePrice + area + 300;
  25. //int newTotalPrice = totalPrice;
  26. }
  27. else {
  28. totalPrice = basePrice + area;
  29.  
  30. }
  31.  
  32. System.out.println("\nPHP "+ totalPrice+ "\n");
  33. System.out.println("would you like to add drawers: Y/N");
  34. System.out.print("> ");
  35. String yn = scan2.nextLine();
  36.  
  37. if (yn.equals("y")||yn.equals("Y")){
  38. System.out.print("\n"+"input number of drawers: "+"\n");
  39. System.out.print("> ");
  40. numDrawers = scan2.nextInt();
  41. int finNum = numDrawers * 50;
  42. totalPrice = totalPrice + finNum;
  43.  
  44. System.out.println("\nPHP "+ totalPrice+ "\n");
  45. System.out.println("\n"+"Choose type of wood: " + "\nA. Narra" + "\nB. Pine");
  46. System.out.print("> ");
  47. String wood= scan3.nextLine();
  48.  
  49. if (wood.equals("a")||wood.equals("A")){
  50. totalPrice = totalPrice + 100;
  51. System.out.println("TOTAL PRICE: PHP"+ totalPrice);
  52.  
  53. System.out.println("\n"+"Would you like to make another order? Y/N");
  54. System.out.print("> ");
  55.  
  56. String ynn = scan4.nextLine();
  57.  
  58. if(ynn.equals("y")||ynn.equals("Y")){
  59. repeat = true;
  60. }
  61.  
  62. else if (ynn.equals("n")||ynn.equals("N")){
  63. //repeat = false;
  64. System.exit(0);
  65. }
  66. }
  67.  
  68. else if (wood.equals("b")||wood.equals("B")){
  69. totalPrice = totalPrice + 200;
  70. System.out.println("TOTAL PRICE: PHP "+ totalPrice);
  71.  
  72. System.out.println("\n"+"Would you like to make another order? Y/N");
  73. System.out.print("> ");
  74. String ynn2 = scan4.nextLine();
  75.  
  76. if(ynn2.equals("y")||ynn2.equals("Y")){
  77. repeat = true;
  78. }
  79.  
  80. else if (ynn2.equals("n")||ynn2.equals("N")){
  81. //repeat = false;
  82. System.exit(0);
  83. }
  84. }
  85. }
  86.  
  87. else if (yn.equals("n")||yn.equals("N")){
  88. System.out.println("\n" +"PHP "+totalPrice);
  89. //System.exit(0);
  90.  
  91. System.out.println("\n"+"Choose type of wood: " + "\nA. Narra" + "\nB. Pine");
  92. System.out.print("> ");
  93. String wood2= scan3.nextLine();
  94.  
  95. if (wood2.equals("a")||wood2.equals("A")){
  96. totalPrice = totalPrice + 100;
  97. System.out.println("TOTAL PRICE: PHP"+ totalPrice);
  98.  
  99. System.out.println("\n"+"Would you like to make another order? Y/N");
  100. System.out.print("> ");
  101.  
  102. String ynn3 = scan4.nextLine();
  103.  
  104. if(ynn3.equals("y")||ynn3.equals("Y")){
  105. repeat = true;
  106. }
  107.  
  108. else if (ynn3.equals("n")||ynn3.equals("N")){
  109. //repeat = false;
  110. System.exit(0);
  111. }
  112.  
  113. }
  114.  
  115. else if (wood2.equals("b")||wood2.equals("B")){
  116. totalPrice = totalPrice + 200;
  117. System.out.println("TOTAL PRICE: PHP "+ totalPrice);
  118.  
  119. System.out.println("\n"+"Would you like to make another order? Y/N");
  120. System.out.print("> ");
  121.  
  122. String ynn2 = scan4.nextLine();
  123.  
  124. if(ynn2.equals("y")||ynn2.equals("Y")){
  125. repeat = true;
  126. }
  127.  
  128. else if (ynn2.equals("n")||ynn2.equals("N")){
  129. //repeat = false;
  130. System.exit(0);
  131. }
  132. }
  133. }
  134.  
  135. }
  136. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement