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

  Trade-offs between quantity and quality of production

Are there inevitable trade-offs between quantity and quality of production and in what ways can job analysis and job redesign help manage there trade-offs?

  Example of a problematic programming situation or scenario

Suggest one (1) example of a problematic programming situation or scenario that the use or implementation of a sequence structure could resolve

  How is singlethreadmodel implemented in tomcat

How is SingleThreadModel implemented in Tomcat? In other containers? I would assume that Tomcat uses its connection thread pool, and creates a new instance of the servlet for each connection thread.

  Write a java program to accept a day number

Write a Java program to accept a day number from the user and display the corresponding day name by using the if/else construct. Rewrite the program using the switch case construct

  Integers as a parameter and returns the number

Write a method maxOccurrences that accepts a list of integers as a parameter and returns the number the number of times the most frequently occurring integer

  Why is the order of the execution of two processes important

Modify the code so that the senderReceiver process sends then receives repeatedly suspending itself for 3 seconds between each iteration.

  Writing a program to calculate state income tax

The second programming project involves writing a program to calculate state income tax for a single taxpayer that uses a GUI. The GUI should use the grid layout manager and should looks similar to the following: The salary income, interest income..

  Generate an amortization schedule

The applet input will be the loan amount, annual percentage rate (APR), and the number of years to pay out the loan. The output will be the loan amount, interest rate per pay period number of pay periods and the monthly payment

  Create online store web site

the Java and JSP source codes and SQL scripts for creating a database in Oracle - any configuration files used

  Implement a shopping cart class with user interface

project will be to implement a shopping cart class with user interface (UI) that contains main() in Net Beans. The UI class will be used to perform user input/output and to invoke the appropriate methods of shopping cart class. When your program star..

  Characteristics and features of programming in java

Discuss the principles, characteristics and features of programming in Java - critically evaluate the environmental flexibility of programming in Java.

  Organizational report

You have been hired as the CIO of a large multinational Internet advertising company. The president of the company is entertaining a major new software development project to keep track of advertising revenues.

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