Define method called getstringinput using the method header

Assignment Help Computer Engineering
Reference no: EM131299576

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.

Reference no: EM131299576

Questions Cloud

What do you learn about its extendability as a result : Pick a brand and conduct an analysis similar to that done with the Planters brand. What do you learn about its extendability as a result?
Prepare a report to submit to the top management : Under a costing system that uses direct labor hours as a driver for the allocation, how much of the inspection costs would be allocated to softball machine - You will present all of this information in a management report divided up into four separ..
Nonpecuniary cost of legislation : Based on this information, what would be the nonpecuniary cost of legislation that would place a $1.50 cap on the fees banks can charge for noncustomer transactions?
What do you think of the interbrand methodology : How do you think Young & Rubicam's BrandAsset Valuator relates to the Interbrand methodology(see Brand Focus 9.0)? What do you see as its main advantages and disadvantages?
Define method called getstringinput using the method header : Define the method called getStringInput( ) using the method header: private static String getStringInput(String prompt)
How would you improve the company''s branding strategies : Do you think the Dow Chemical corporate image campaign described in this chapter will be successful? Why or why not? What do you see as key success factors for a corporate image campaign?
Essential foundations of economics : When looking at the Fed, you will find that decisions within markets are critical to what they have to do. How do you think the Fed can create opportunities for markets to be more stable?
Why they have such strong corporate reputations : Consider the companies listed in Branding Brief 11-3 as having strong corporate reputations. By examining their Web sites, can you determine why they have such strong corporate reputations?
Define cognitive aid and their application in systems design : Define cognitive aids and their applications in systems design. Enumerate and explain briefly any four principles affecting flexibility principle. Differentiate between Multi-modal system and multimedia system.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Write down the worst cardiac simulator of all time

make the worst CARDIAC simulator of all time (in C++) that tells the user how to execute only a single instruction typed as a 3 digit number by the user.

  Compute the total capacity of the ram chips in bits

Summarise the address space by drawing a memory map of the computer system. Indicate the starting and ending addresses in hexadecimal for each ROM and RAM chips and any unused space. Show how the memory addresses are obtained - Compute the total c..

  Give an illustration in which polymorphism would be helpful

write a 200- to 300-word short-answer response to the followingprovide an example in which polymorphism would be

  While running snort ids why may there be no alerts

While running Snort IDS why may there be no alerts

  Give solutions of both mobile and server communications

What security suggestions do you have for laptop users to securely access network resources, and to secure files on their laptops.

  Explaining dynamic programming approach

Assume we have a directed the acyclic graph G = (V,E) with the real-valued edge weights and two distinguished vertices s and t.

  What are the potential benefits to consumers

What are the implications for firms operating in effected industries? What are the potential benefits to consumers? Do consumers lose anything from this legislation? Include the urls of your sources

  Developing program for real estate agent in java language

Write down a java program for the real estate agent. The program must carry out the following tasks: Ask the users for average house price for the each of the past 5 years for the single family residence of 1500 square feet.

  Speculate on whether something such as sound can be

1.identify at least one place other than computers where binary math is used and explain why it is or is not suitable

  You can easily and quickly deploy applications via a gui

1.you can easily and quickly deploy applications via a gui interface and push via a browser. historically many

  Make a program display a sports related image of your choice

design a document that contains four short paragraphs of text, stacked on top of each other, with only enough of each showing so that the mouse cursor can always be placed over some part of them.

  Bcnf and demonstrate how you will fix it

Find out or create an example of a violation of a normal form that you would allow, tell why you are allowing the violation and explain how you would protect against anomalies.

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