Offered Price $50.00

For this assignment, you will be adding additional logic to handle a....

Question # 00073910
Subject: Computer Science
Due on: 06/23/2015
Posted On: 06/01/2015 04:42 PM

Expert tutors with experiences and qualities
Posted By
Best Tutors for school students, college students
Feedback Score:

Purchase it
Report this Question as Inappropriate

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.

The output from running the program should include additional boxes that are similar to the following PizzasRUs example:

Tags handle logic additional adding aignment cost value method order number string quantity total double customer program following getstringinput sales additional totalcost items select request prompt color reasonable returned properties including private create using unit static

Tutorials for this Question
Available for

additional logic

Tutorial # 00068566
Posted On: 06/01/2015 09:19 PM
Posted By:
Best Tutors for school students, college students neil2103
Expert tutors with experiences and qualities
Feedback Score:
Report this Tutorial as Inappropriate
Tutorial Preview ……
Attachments (0.75 KB)
Preview not available.
Purchase this Tutorial @ $50.00 *
* - Additional Paypal / Transaction Handling Fee (3.9% of Tutorial price + $0.30) applicable