Advertisement
Guest User

Untitled

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