Sale!

CSC 210.03 Assignment 7 COFFEE SHOP ACCOUNTING OPERATIONS solved

Original price was: $35.00.Current price is: $28.00.

Category:

Description

5/5 - (1 vote)

❐Part 1: CoffeeShopInventoryManagerNew [10 points]

File Name: CoffeeShopInventoryManagerNew.java 1. (Total 10 points) Refactor previous CoffeeShopInventoryManager.java and combine 2 arrays into 1-2D array and keep your first array “items” a. (1 points) You should already have the first array “items” should contain 5 items {“cups”, “coffee beans”, “lids”, “towel”, “sleeves”}. Use Array-Initializer notation for assigning these 5 values to this array.

b. (2 points) Create a 1D array “labels” for each row, first element of the array is “quantity”, and second is “price”. c. (4 points) Initialize the secondary array, a 2D array, with length of “items” and “labels”. Do not hardcode the amount of row and columns of the 2D array – points will be taken off for hardcoded array row and column lengths. int[][] my2D arr = new int [2][5] -> new int [items.length][labels.length]This second array, named “values” its first row, should contain quantity for each of the corresponding elements in “items”.

The second row should contain the price per piece of the corresponding “items“. Obtain these quantities and prices from the user in one loop. Check if it is a valid number (greater than or equal to 0).

labels = {quantity, price}; for int i =0 items.length for intj =0 label.length temp = scan.nextInt(); do if temp <0 /print out enter value bigger than 0 else myArr[][] = temp while(temp < 0) System.println(label[i]) // row 0 ,print quantity, row 1 print price items[index for items] d. (3 points) Use all arrays in one loop to output a helpful message to the user, prompting entry into each row label and each item name, for each entry into the 2D array. See output below:

Please paste your screenshot for this scenario here: Output :

❐Part 2: CoffeeShopInventoryManagerNew [17 points]

2. (Total 17 points) A typical user of this program is the inventory manager. Refactor your previous CoffeeShopInventoryManager file such that this new file has at least 6 methods a. (2 points) 1st method: “getMenu”. Display to the user the possible operations on the inventory and prompt her/him to choose one. There are 6 possible operations: Print Inventory, Check for low inventory, Total inventory value, Highest and lowest inventory value items, Ordering More Inventory, and Exit. – Use a switch case to direct the program to call the other methods.

The details of each of these operations are given below. – If the user enters an invalid menu option please prompt them to input the correct numbers Please paste your screenshot for this invalid scenario here: Output :

b. (3 points)2nd method: “printInventory”. This operation prints the inventory in the following format: Item Name, Quantity, Value then Item Name, Price , Value.. Go back to step a. Please paste your screenshot for this scenario here: Output :

c. (3 points) 3rd method: “checkInventory”: This operation checks for items that have 5 or fewer quantity, and prints them in the same format as in option(b). If there is no such item then print an appropriate message. Finally, go back to step a. Please paste your screenshot for this scenario here: Output :

d. (3 points) 4th method: “minMaxInventory” This operation finds the item with the highest inventory value (quantity*price-per-piece), If there is more than one item with the same highest (or lowest) value then display all such items. Finally, go back to step a. Please paste your screenshot for this scenario here: Output :

e. (2 points) 5th method: “getTotal”. This operation computes the grand total value of the current inventory using the quantity and price per piece information, and prints that grand total value. Finally, go back to step a. Please paste your screenshot for this scenario here: Output :

f. (3 points) 6th method: “orderInventory”. This operation displays the menu of items and asks the user to enter the number they would like to order. This operation also updates the main value 2D array quantity chosen and returns an array to the main method, which updates the original array. Finally, go back to step a. For example if a towel was chosen to add quantity of 12, then the next printout towel value has been updated. See towel item below was 35 and now it is 47.

Please paste your screenshot for this scenario here: Output : Before After g. (1 point) Exit (e): Exits the program.

Please paste your screenshot for this scenario here: Output :

❐Part 3: Reflect 50 words [8 points] Let’s reflect on what we’ve learned so far.

 

❐Part 4 Optional Extra Credit : Ask and Answer [3 e.c

points] Ask or Answer a question posted in this form 👋 Assignment 7 Part 4: Ask and Answer