Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

For this assignment, you will be adding additional logic to handle a few additional properties of the order, the simple validation of properties, and the total cost of the order, including sales tax. You will implement these new capabilities using methods that you create.

1. Define the method called getStringInput( ) using the method header: private static String getStringInput(String prompt)

This method must do the following:

Use JOptionPane.showInputDialog( ) to display the prompt.

Check the value that is returned.

If the value is null, the program should terminate.

If the value is a nonempty string, that string should be returned as the value of the method.

Otherwise, this request sequence should be repeated up to 3 times.

If the customer has not entered a valid input by then, the program should make an appropriate comment and then terminate.

2. Replace your existing code that requests the customer's name, return status, and color with calls to getStringInput( ).

3. Add a request for quantity, or the number of items that the customer wishes to order. Use getStringInput( ) to obtain this value from the customer. You will need to convert the quantity string into an int value. You should use the Integer.parseInt( ) method to accomplish this.

4. Create a method called totalCost( ) that calculates the total cost of an order. Use the following header:

private static double totalCost(int number, double cost, double salesTaxRate)

Number is ***** number of items (the quantity), cost is the unit cost (the cost of a single item), and salesTax is the sales tax rate. You should select a reasonable value for the unit cost (e.g., $10.00). You should select a reasonable value for the sales tax rate (e.g., 7%). Use your totalCost( ) method to calculate the total cost of the order.

5. Enhance your confirmation dialog so that it displays the entire order, including the name, the color, the quantity, and the total cost.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92054224
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Computer Engineering

How does a java server page uses the client-server model to

How does a Java Server Page uses the client-server model to make a Web page interactive?

When searching for the entry x within the list r s t u v w

When searching for the entry X within the list R, S, T, U, V, W, Z how many entries will be considered before discovering that the entry is not present? (Note that the list is in alphabetical order.)

Select a company with which you are at least somewhat

Select a company with which you are at least somewhat familiar. Explain how this particular company could benefit from a data warehousing and data mining initiative. What value do you see in data mining in the context of ...

What effect does the teacher have on creating a learning

What effect does the teacher have on creating a learning environment with little to no behavior problems?

Suppose you had the following backup plan full backups on

Suppose you had the following backup plan: Full backups on the first Sunday of every month, differential backups on the other Sundays of the month, and incremental backups M-F. Suppose something bad happened on April 26t ...

What are some ways malware can effect a mac computer can

What are some ways malware can effect a mac computer? Can they be prevented?

Lnguage isnbspcgenerate a sparse vector class with

Language is  C++ Generate a sparse vector class with * operator, such as  Vector Vector::operator * (Vector& param) A multiplication (*) operators returns element-wise multiplication of two vectors in another vector. Giv ...

When using todays digital cameras file sizes are often

When using today's digital cameras file sizes are often saved in a format that is well over 1 Megabyte. This may be great for high definition photo reproductions but is a disaster for uploading to the web. Images on your ...

Er database modeling questionemployees have an id name

ER database modeling question: Employees have an id, name, department and datejoined. A manager who is also an employee is managing a department and can be a manager of several employees in that department. Ignore Depart ...

Wat are three 3 major categories of cyber terrorism and

What are three (3) major categories of cyber terrorism and / or information warfare. Among the chosen categories, determine the one (1) that should be the top priority for the federal government to address.

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As