Question: Description: The following workshop lets you practice basic java coding techniques, creating classes, methods, 2D array. Task 1: (2D array Challenge) Use a two-dimensional array


Description: The following workshop lets you practice basic java coding techniques, creating classes, methods, 2D array. Task 1: (2D array Challenge) Use a two-dimensional array to solve the following problem: - A company has - Four salespeople (1 to 4) who sell five different products (1 to 5). - Once a day, each salesperson passes in a slip for each type of product sold. Each slip contains the following: 1. The salesperson number 2. The product number 3. The total dollar value of that product sold that day - Thus, each salesperson passes in between 0 and 5 sales slips per day. - Assume that the information from all the slips for last month is available. Write an application that will read all this information for last month's sales and summarize the total sales by salesperson and by product. - All totals should be stored in the two-dimensional array sales. - After processing all the information for last month, display the results in tabular format, with each column representing a salesperson and each row representing a particular product. Cross-total each row to get the total sales of each product for last month. - Cross-total each column to get the total sales by salesperson for last month. - Your output should include these cross-totals to the right of the totaled rows and to the bottom of the totaled columns. Hints: - I would recommend creating two classes for this problem at the minimum SalesSlip to manage the class behaviors - getPerson() - getProduct() - getValue() - 2D array to represent products and salesperson - For last month sales slips use random --- for example create 100 sale slip records as single dimension array and store. This output is generated using random numbers no user input required. Task 2: (Class Practice) Write a class named GroceryList that represents a list of items to buy from the market, and another class named GroceryltemOrder that represents a request to purchase a particular item in a given quantity (example: four boxes of cookies). The GroceryList class should use an array field to store the grocery items and to keep track of its size (number of items in the list so far). Assume that a grocery list will have no more than 10 items. A GroceryList object should have the following methods: - public GroceryList() Constructs a new empty grocery list. - public void add(GroceryltemOrder item) Adds the given item order to this list if the list has fewer than - public double getTotalCost() 10 items. list. The GroceryltemOrder class should store an item quantity and a price per unit. A GroceryltemOrder object should have the following methods: - public GroceryltemOrder(String name, int quantity, double pricePerUnit) Constructs an item order to purchase the item with the given name, in the given quantity, which costs the given price per unit. - public double getCost() Returns the total cost of this item in its given quantity. For example, four boxes of cookies that cost 2.30 per unit have a total cost of 9.20. - public void setQuantity(int quantity) Sets this grocery item's quantity to be the given value Note: Students will be creating their own testing class for this task and your testing class should test all the functionalities. You are more than welcome to create a menu to do the grocery as well
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
