Implement a validation plan to get a valid input

Assignment Help JAVA Programming
Reference no: EM131031922

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

Reference no: EM131031922

Questions Cloud

Explain what it means for a student to be successful : For this essay you will explain what it means for a student to be successful in an online classroom and then argue which three characteristics or habits that are most essential for students to achieve success in an online classroom.
Evaluates the supplier of their deep-frozen beef patties : The management of a large fast food chain evaluates the supplier of their deep-frozen beef patties. The supplier delivers frozen beef patties that according to the specifications have to weigh between 94.5 grams and 95.5 grams. All other beef patties..
Four-step assembly operation with quality problems : Consider the following four-step assembly operation with quality problems: The first resource has a processing time of 5 minutes per unit and one employee doing the operation. The second resource has a processing time of 4 minutes per unit. No qualit..
Relevant regulatory officials are asking for consulting fee : Assume that you are the Vice-President for International Operations for the XYZ Widget Company. You are under pressure from the CEO to significantly increase the sale of widgets across Asia. To break into the market in some countries, the relevant re..
Implement a validation plan to get a valid input : 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
Discuss the five major kinds of drivers of globalization : Discuss the five major kinds of drivers of globalization as it applies for your chosen company. Analyze the basic needs potential for the markets of your chosen company. Analyze the applicable financial and economic forces. Analyze the applicable pol..
Two quality management styles : Based either on your work experience or on the readings in this course or both, discuss the following:  What should prevail in a company, TQM by facts or intuitive decisions that are made without regard to facts? What is generally the impact of the t..
Discuss how csr has become an important part of business : Discuss how CSR has become an important part of business and give examples of at least 2 companies who have been very active in regard to their social responsibility.
Who are the three best-known quality pioneers : Who are the three best-known quality pioneers? Describe and then compare their individual contributions to quality. Look through the ITT Tech Virtual Library and identify a major company that adopted one or more of the pioneers' strategies. Suggest h..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Perform a unit test of the shoutbox

Perform a unit test of the MyClone to test all getters and setters and methods - Perform a unit test of the ShoutBox to test all methods.

  Design a java program that simulates a slot machine

Design a java program that simulates a slot machine. When the program runs, it should do the following: Ask the user to enter the amount of money he or she wants to insert into the slot machine. ? Instead of displaying images, the program will random..

  Create java applet to represent grade of gas

Write a java applet (not a java application program) for costco gas station. The applet will first ask you whether you are a costco customer, then the grade of gas you want to use.

  Demonstrate how the quicksort algorithm behaves

Demonstrate how the quicksort algorithm behaves. You will be implementing quicksort, but in a way that allows the program's user to visually observe how the algorithm proceeds by watching animated colored bars.

  Functional abstraction

Question 1: What are some of the benefits of modularity? Question 2: What is functional abstraction? Question 3: What is information hiding?

  Explain how to declare and manipulate data in arrays

Please respond to all of the following prompts: Explain how to declare and manipulate data in arrays. Explain the meaning of "array index out of bounds".

  Java class to accept a user-s hourly rate of pay

Write a class that accepts a user's hourly rate of pay and the number of hours worked. Display the user's gross pay, the withholding tax (15% of gross pay), and the net pay (gross pay - withholding).

  Calculator to indicate sale prices when he marks items down

A retailer would like a calculator to indicate sale prices when he marks items down at various percentages.

  Difference between the abstract class and interface

1. What is the difference between the Abstract Class and Interface.2. Write a java Program that counts number of words in each line of the file.

  Write a java program that computes and prints the value

Write a Java program that computes and prints the value of 6!/5! using Scanner.

  What is one example from the list in table of popular

based on the keston 2013 article what are the advantages and disadvantages of using mashups? what is one example from

  Calculate and return the sum of the geometric series

calculate and return the sum of the geometric series

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd