Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You currently manage four stores and have the following data. The first row acro

ID: 3555317 • Letter: Y

Question

You currently manage four stores and have the following data. The first row across list the store numbers, the first column lists the items you carry and the numbers represent the quantity of the item.

                       Store 101    Store 102    Store 103   Store 104

Tennis Shoes       102             54              20              78
Sweaters             45               25              35              75
Jeans                  12               35              45               65
Shorts                 54               25             34              45
Jackets               15               35              50               25

Create a 2-dimensional array for the data above. Create a demonstration program that does the following:

Allows the manager to enter a store number and displays the quantity of all the items at the store.


Allows the manager to enter a store number and item and displays the quantity for that store and item.


Allows the manager to enter an item and displays the quantity for each store.


Allows the manager to enter a specific quantity and returns all items whose inventory is below the specified quantity (For example, if the manager enters 25 then the program would display the following: Store 103 Tennis Shoes, Store 101 Jeans and Jackets   

Explanation / Answer

html*/ import java.util.Scanner; public class Store { public static void main(String[] args) { int num; int column = -1; int row = -1; int quantity; String name; int[] StoreNo = { 101, 102, 103, 104 }; String[] storeName = { "tennis shoes", "sweaters", "jeans", "shorts", "jackets" }; int[][] data = { { 102, 54, 20, 78 }, { 45, 25, 35, 75 }, { 12, 35, 45, 65 }, { 54, 25, 34, 45 }, { 15, 35, 50, 25 } }; try { Scanner input = new Scanner(System.in); System.out .println("**************Demonstration-1******************"); System.out.println("Enter the store no :"); num = input.nextInt(); for (int i = 0; i < StoreNo.length; i++) { if (num == StoreNo[i]) column = i; } for (int i = 0; i < storeName.length; i++) { System.out.println(storeName[i] + " :" + data[i][column]); } System.out .println("**************Demonstration-2******************"); System.out.println("Enter the store num :"); num = input.nextInt(); System.out.println("Enter the item name :"); name = input.next(); for (int i = 0; i < StoreNo.length; i++) { if (num == StoreNo[i]) { for (int j = 0; j < storeName.length; j++) { if (storeName[j].equals(name)) { row = j; column = i; break; } } } } System.out.println("Quantity Of that store is :" + data[row][column]); System.out .println("**************Demonstration-3******************"); System.out.println("Enter the item name :"); name = input.next(); for (int i = 0; i < storeName.length; i++) { if (storeName[i].equals(name)) { row = i; } } for (int i = 0; i < StoreNo.length; i++) { System.out.println("Store No -" + StoreNo[i] + " :" + data[row][i]); } System.out .println("**************Demonstration-4******************"); System.out.println("Enter the quantity :"); quantity = input.nextInt(); for (int i = 0; i < storeName.length; i++) { for (int j = 0; j < StoreNo.length; j++) { if (data[i][j] < quantity) { System.out.println("Store " + StoreNo[j] + " " + storeName[i]); } } } } catch (Exception e) { System.out.println("Invalid Entry"); } } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote