Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class UserInterface
- {
- public static void main(String[] args)
- {
- double bpWeight = 0;
- double bpVolume = 0;
- Scanner input = new Scanner(System.in);
- UserInterface ui = new UserInterface();
- BackPack bp = new BackPack();
- WaterBottle wb = new WaterBottle();
- FoodPacket fp = new FoodPacket();
- Potion p = new Potion();
- double bPC = ui.getBackPackCapacity(bp.getCapacity());
- double bPW = ui.getBackPackWeight(bp.getWeight());
- BackPack bp2 = new BackPack(bPC, bPW);
- String message = bp.toString(bPC,bPW); //USE FOR LATER
- System.out.println(message); //USE FOR LATER
- // BACKPACK TOSTRINGED
- // // POTION ATTRIBUTES
- double pW = ui.getPotionWeight(p.getWeight());
- double pV = ui.getPotionVolume(p.getVolume());
- String pD = ui.getPotionDescription(p.getDescription());
- Potion p3 = new Potion(pW, pV, pD);
- String messagePotion = p.toString(pW, pV, pD);
- // System.out.println(messagePotion);
- //// //POTION TOSTRINGED
- //FOOD ATTRIBUTES
- int fH = ui.getFoodHeight(fp.getHeight());
- int fW = ui.getFoodWidth(fp.getWidth());
- int fD = ui.getFoodDepth(fp.getDepth());
- double fWgt = ui.getFoodWeight(fp.getWeight());
- double fVol = fp.getVolume(fW, fH, fD);
- FoodPacket fp4 = new FoodPacket(fH, fW, fD, fWgt);
- String messageFood = fp.toString(fH, fW, fD, fWgt, fVol);
- // System.out.println(messageFood);
- // // FOUND THE HEIGHT, WIDTH, DEPTH, WEIGHT, AND VOLUME FOR FOOD PACKETS.
- //
- //
- // //WATER ATTRIBUTES
- int wH = ui.getWaterBottleHeight(wb.getHeight());
- int wR = ui.getWaterBottleRadius(wb.getRadius());
- double wVol = wb.getVolume(wH, wR);
- double wWgt = wb.getWeight(wVol);
- WaterBottle wb2 = new WaterBottle(wH, wR);
- String messageWater = wb.toString(wH, wR, wWgt, wVol);
- System.out.println(messageWater);
- // // OKAY I FOUND THE HEIGHT, RADIUS, VOLUME, AND WEIGHT FOR WATER.
- String prompt;
- String prompt2;
- do
- {
- System.out.println("Do you want to interact with the backpack (Y/N)");
- prompt = input.nextLine().toLowerCase();
- if (prompt.equals("y"))
- {
- System.out.println("Do you want to add or remove from the backpack? (A/R)");
- prompt2 = input.nextLine().toLowerCase();
- if (prompt2.equals("a"))
- {
- String choice;
- System.out.println("What item would you like to add? (W/F/P)");
- choice = input.nextLine().toLowerCase();
- if (choice.equals("w"))
- {
- double waterTest = bp.addWaterBottle(wWgt, wVol);
- }
- else if (choice.equals("f"))
- {
- }
- else if (choice.equals("p"))
- {
- }
- else
- {
- System.out.println("Invalid item");
- }
- }
- else if (prompt2.equals("r"))
- {
- String choice2;
- System.out.println("What item would you like to remove? (W/F/P)");
- choice2 = input.nextLine().toLowerCase();
- if (choice2.equals("w"))
- {
- }
- else if (choice2.equals("f"))
- {
- }
- else if (choice2.equals("p"))
- {
- }
- else
- {
- System.out.println("Invalid item");
- }
- }
- else
- {
- System.out.println("invalid answer.");
- }
- System.out.println(message);
- System.out.println("the current volume is " + bpVolume + " cubic feet, current weight is " + bpWeight + " pounds.");
- }
- else if (prompt.equals("n"))
- {break;}else{System.out.println("Invalid answer.");}
- }while (!prompt.equals("n"));
- System.out.println("Thank you for using the inventory management system.");
- }
- public double getBackPackCapacity(double backPackC) //1
- {
- Scanner input = new Scanner(System.in);
- System.out.println("What is the capacity of the backpack (cubic feet)");
- backPackC = input.nextDouble();
- input.nextLine();
- return backPackC;
- }
- public double getBackPackWeight(double backPackW)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("What is the maximum weight allowance for the backpack (pounds)");
- backPackW = input.nextDouble();
- input.nextLine();
- return backPackW;
- }
- public int getWaterBottleHeight(int wHeight)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter the height of the water bottle.");
- wHeight = input.nextInt();
- input.nextLine();
- return wHeight;
- }
- public int getWaterBottleRadius(int wRadius)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter the radius of the water bottle.");
- wRadius = input.nextInt();
- input.nextLine();
- return wRadius;
- }
- public int getFoodHeight(int fHeight)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter the height of the food packet.");
- fHeight = input.nextInt();
- input.nextLine();
- return fHeight;
- }
- public int getFoodWidth(int fWidth)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter the width of the food packet.");
- fWidth = input.nextInt();
- input.nextLine();
- return fWidth;
- }
- public int getFoodDepth(int fDepth)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter the depth of the food packet.");
- fDepth = input.nextInt();
- input.nextLine();
- return fDepth;
- }
- public double getFoodWeight(double fWeight)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter the weight of the food packet.");
- fWeight = input.nextDouble();
- input.nextLine();
- return fWeight;
- }
- public double getPotionWeight(double pWeight)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter the weight of the potion.");
- pWeight = input.nextDouble();
- input.nextLine();
- return pWeight;
- }
- public double getPotionVolume(double pVolume)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter the volume of the potion.");
- pVolume = input.nextDouble();
- input.nextLine();
- return pVolume;
- }
- public String getPotionDescription(String pDes)
- {
- Scanner input = new Scanner(System.in);
- System.out.println("Please enter a description for the potion.");
- pDes = input.nextLine();
- return pDes;
- }
- public double maximumVerify(double weight, double volume)
- {
- double placeholder = 0;
- return placeholder;
- }
- // public double getVolumeTest(double water, double food, double potion)
- // {
- // Scanner input = new Scanner(System.in);
- // System.out.println("Water");
- // water = input.nextInt(); input.nextLine();
- // System.out.println("food");
- // food = input.nextInt(); input.nextLine();
- // System.out.println("Potion");
- // potion = input.nextInt(); input.nextLine();
- // return water += food += potion;
- //
- // }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement