You need to implement a validation plan to get a valid


Implementation-

Task 1 - Presenting the Catalogue

In the beginning of the program, print to a table the catalogue for all products including name, code, and price to assist users shopping. You should use a loop plan to access the data stored in productListArr and priceListArr and present it in a four-column table, like Figure 4, where each column is a set of products with code, name, and price.

Task 2 - A Validation Plan for Valid Product Codes

You need to implement a validation plan to get a valid input from the user for product code. An input value is considered invalid if:

- it is not a number at all;

- it is not an integer number;

- it is a negative number;

- it is a number out of range (greater than or equal to the size of   productListArr).

Task 3 - A Validation Plan for Valid Quantity  Values

You need to implement another validation plan to get a valid input from the user for quantity. An input value is considered invalid if:

- it is not a number at all;

- it is not an integer number;

- it is zero or a negative number;

- it is greater than 100.2

Task 4 - An Iteration Plan for Information Gathering   Phase

You need to design a looping plan to implement the Information Gathering Phase. Refer to Functional Requirements and Fig. 1 for the detail of data flow in the loop. Clearly, this task should incorporate the works in Task 2 and 3.

Task 5 - A Sum Plan to Calculate the Total   Cost

Your program needs to calculate the total cost for all ordered products in the shopping cart. The calculation formula is provided:

totalCost(cart) =  Σicart pricei × quantityi

Task 6 - A Maximum Plan to Find the Most Expensive Product in Cart

Your program needs to find the most expensive product in the shopping cart. To do it, for each of the products added in to the cart you need to retrieve the corresponding price from priceListArr, and then compare the prices one by one. Once you find out the most expensive price, the corresponding product item in productListArr will be the most expensive product in the shopping   cart.

If you have multiple products in the cart sharing the same most expensive price you can select any one of them as the "most expensive product".

Task 7 - A Minimum Plan to Find the Least Expensive Product in Cart

Your program also needs to find the least expensive product in the shopping cart. You may adopt the same strategy in previous task for this task. Again, if you have multiple products in the cart sharing the same least expensive price you can select any one of them as the "least expensive product".

Task 8 - An Average Plan to Calculate the Average Cost

Your program needs to be able to calculate the average cost for all product items in the shopping cart.     This can be done by the total cost divided by the accumulated value of quantities:

averageCost(cart) = Σicart pricei × quantityi/ Σicart quantityi

You should handle the "Division by Zero" exception when calculating average.

Task 9 - Presenting the Cart

Print to a table the detailed information of shopping cart, such as product name, price, quantity, and cost. You should adopt an iteration plan to visit the elements stored in quantityArr and orderedP roductCodeArr in order to get the index to retrieve product names and prices from productListArr and priceListArr.

All currency values should be at cents in terms of precision.3

Task 10 - Presenting the Statistics

Print to an unordered list the statistic information (total cost, most expensive item, least expensive item, and average cost per unit for the ordered product items) on shopping cart.

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: You need to implement a validation plan to get a valid
Reference No:- TGS01377854

Expected delivery within 24 Hours