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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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