Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.02 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class UserInterface
  4. {
  5.  
  6.  
  7. public static void main(String[] args)
  8. {
  9. double bpWeight = 0;
  10. double bpVolume = 0;
  11. Scanner input = new Scanner(System.in);
  12. UserInterface ui = new UserInterface();
  13. BackPack bp = new BackPack();
  14. WaterBottle wb = new WaterBottle();
  15. FoodPacket fp = new FoodPacket();
  16. Potion p = new Potion();
  17. double bPC = ui.getBackPackCapacity(bp.getCapacity());
  18. double bPW = ui.getBackPackWeight(bp.getWeight());
  19. BackPack bp2 = new BackPack(bPC, bPW);
  20. String message = bp.toString(bPC,bPW); //USE FOR LATER
  21. System.out.println(message); //USE FOR LATER
  22. // BACKPACK TOSTRINGED
  23.  
  24. // // POTION ATTRIBUTES
  25. double pW = ui.getPotionWeight(p.getWeight());
  26. double pV = ui.getPotionVolume(p.getVolume());
  27. String pD = ui.getPotionDescription(p.getDescription());
  28. Potion p3 = new Potion(pW, pV, pD);
  29. String messagePotion = p.toString(pW, pV, pD);
  30. // System.out.println(messagePotion);
  31. //// //POTION TOSTRINGED
  32.  
  33. //FOOD ATTRIBUTES
  34. int fH = ui.getFoodHeight(fp.getHeight());
  35. int fW = ui.getFoodWidth(fp.getWidth());
  36. int fD = ui.getFoodDepth(fp.getDepth());
  37. double fWgt = ui.getFoodWeight(fp.getWeight());
  38. double fVol = fp.getVolume(fW, fH, fD);
  39. FoodPacket fp4 = new FoodPacket(fH, fW, fD, fWgt);
  40. String messageFood = fp.toString(fH, fW, fD, fWgt, fVol);
  41. // System.out.println(messageFood);
  42. // // FOUND THE HEIGHT, WIDTH, DEPTH, WEIGHT, AND VOLUME FOR FOOD PACKETS.
  43. //
  44. //
  45. // //WATER ATTRIBUTES
  46. int wH = ui.getWaterBottleHeight(wb.getHeight());
  47. int wR = ui.getWaterBottleRadius(wb.getRadius());
  48. double wVol = wb.getVolume(wH, wR);
  49. double wWgt = wb.getWeight(wVol);
  50. WaterBottle wb2 = new WaterBottle(wH, wR);
  51. String messageWater = wb.toString(wH, wR, wWgt, wVol);
  52. System.out.println(messageWater);
  53. // // OKAY I FOUND THE HEIGHT, RADIUS, VOLUME, AND WEIGHT FOR WATER.
  54.  
  55.  
  56. String prompt;
  57. String prompt2;
  58. do
  59. {
  60. System.out.println("Do you want to interact with the backpack (Y/N)");
  61. prompt = input.nextLine().toLowerCase();
  62. if (prompt.equals("y"))
  63. {
  64. System.out.println("Do you want to add or remove from the backpack? (A/R)");
  65. prompt2 = input.nextLine().toLowerCase();
  66. if (prompt2.equals("a"))
  67. {
  68. String choice;
  69. System.out.println("What item would you like to add? (W/F/P)");
  70. choice = input.nextLine().toLowerCase();
  71.  
  72. if (choice.equals("w"))
  73. {
  74. double waterTest = bp.addWaterBottle(wWgt, wVol);
  75.  
  76.  
  77. }
  78. else if (choice.equals("f"))
  79. {
  80.  
  81. }
  82. else if (choice.equals("p"))
  83. {
  84.  
  85. }
  86. else
  87. {
  88. System.out.println("Invalid item");
  89. }
  90.  
  91. }
  92.  
  93. else if (prompt2.equals("r"))
  94. {
  95. String choice2;
  96. System.out.println("What item would you like to remove? (W/F/P)");
  97. choice2 = input.nextLine().toLowerCase();
  98. if (choice2.equals("w"))
  99. {
  100.  
  101. }
  102. else if (choice2.equals("f"))
  103. {
  104.  
  105.  
  106. }
  107. else if (choice2.equals("p"))
  108. {
  109.  
  110. }
  111. else
  112. {
  113. System.out.println("Invalid item");
  114. }
  115.  
  116. }
  117.  
  118. else
  119. {
  120. System.out.println("invalid answer.");
  121. }
  122.  
  123.  
  124. System.out.println(message);
  125. System.out.println("the current volume is " + bpVolume + " cubic feet, current weight is " + bpWeight + " pounds.");
  126.  
  127.  
  128.  
  129. }
  130.  
  131.  
  132.  
  133. else if (prompt.equals("n"))
  134. {break;}else{System.out.println("Invalid answer.");}
  135. }while (!prompt.equals("n"));
  136. System.out.println("Thank you for using the inventory management system.");
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143. }
  144. public double getBackPackCapacity(double backPackC) //1
  145. {
  146. Scanner input = new Scanner(System.in);
  147. System.out.println("What is the capacity of the backpack (cubic feet)");
  148. backPackC = input.nextDouble();
  149. input.nextLine();
  150. return backPackC;
  151. }
  152. public double getBackPackWeight(double backPackW)
  153. {
  154. Scanner input = new Scanner(System.in);
  155. System.out.println("What is the maximum weight allowance for the backpack (pounds)");
  156. backPackW = input.nextDouble();
  157. input.nextLine();
  158. return backPackW;
  159. }
  160. public int getWaterBottleHeight(int wHeight)
  161. {
  162. Scanner input = new Scanner(System.in);
  163. System.out.println("Please enter the height of the water bottle.");
  164. wHeight = input.nextInt();
  165. input.nextLine();
  166. return wHeight;
  167. }
  168.  
  169. public int getWaterBottleRadius(int wRadius)
  170. {
  171. Scanner input = new Scanner(System.in);
  172. System.out.println("Please enter the radius of the water bottle.");
  173. wRadius = input.nextInt();
  174. input.nextLine();
  175. return wRadius;
  176. }
  177. public int getFoodHeight(int fHeight)
  178. {
  179. Scanner input = new Scanner(System.in);
  180. System.out.println("Please enter the height of the food packet.");
  181. fHeight = input.nextInt();
  182. input.nextLine();
  183. return fHeight;
  184. }
  185. public int getFoodWidth(int fWidth)
  186. {
  187. Scanner input = new Scanner(System.in);
  188. System.out.println("Please enter the width of the food packet.");
  189. fWidth = input.nextInt();
  190. input.nextLine();
  191. return fWidth;
  192. }
  193. public int getFoodDepth(int fDepth)
  194. {
  195. Scanner input = new Scanner(System.in);
  196. System.out.println("Please enter the depth of the food packet.");
  197. fDepth = input.nextInt();
  198. input.nextLine();
  199. return fDepth;
  200. }
  201. public double getFoodWeight(double fWeight)
  202. {
  203. Scanner input = new Scanner(System.in);
  204. System.out.println("Please enter the weight of the food packet.");
  205. fWeight = input.nextDouble();
  206. input.nextLine();
  207. return fWeight;
  208. }
  209. public double getPotionWeight(double pWeight)
  210. {
  211. Scanner input = new Scanner(System.in);
  212. System.out.println("Please enter the weight of the potion.");
  213. pWeight = input.nextDouble();
  214. input.nextLine();
  215. return pWeight;
  216. }
  217. public double getPotionVolume(double pVolume)
  218. {
  219. Scanner input = new Scanner(System.in);
  220. System.out.println("Please enter the volume of the potion.");
  221. pVolume = input.nextDouble();
  222. input.nextLine();
  223. return pVolume;
  224. }
  225. public String getPotionDescription(String pDes)
  226. {
  227. Scanner input = new Scanner(System.in);
  228. System.out.println("Please enter a description for the potion.");
  229. pDes = input.nextLine();
  230. return pDes;
  231. }
  232.  
  233.  
  234. public double maximumVerify(double weight, double volume)
  235. {
  236. double placeholder = 0;
  237. return placeholder;
  238. }
  239.  
  240.  
  241. // public double getVolumeTest(double water, double food, double potion)
  242. // {
  243. // Scanner input = new Scanner(System.in);
  244. // System.out.println("Water");
  245. // water = input.nextInt(); input.nextLine();
  246. // System.out.println("food");
  247. // food = input.nextInt(); input.nextLine();
  248. // System.out.println("Potion");
  249. // potion = input.nextInt(); input.nextLine();
  250. // return water += food += potion;
  251. //
  252. // }
  253.  
  254.  
  255. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement