Advertisement
Guest User

Untitled

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