Define the method called getstringinput( ) using the method

Assignment Help Basic Computer Science
Reference no: EM13537722

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 the 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.

Reference no: EM13537722

Questions Cloud

Calculate the magnitude of the charge of the particle : A positively charged particle of mass 6.00 10-8 kg is traveling due east with a speed of 80 m/s and enters a 0.42 T uniform magnetic field. What is the magnitude of the charge of the particle
Explain the bomb was immersed of water : A chemical engineer studying the properties of fuels placed 1.500 g of a hydrocarbon in the bomb of a calorimeter and filled it with O2 gas. The bomb was immersed in 2.500 L of water and the reaction initiated.
Implement a personal scheduler windows application : Implement a personal scheduler Windows application - Entries can be enabled and disabled: Enabled schedule entries appear dark in the main window, and disabled entries appear grayed out in the list.
Explain the type of equilibrium : When all of the products and reactants are gases, the type of equilibrium that will be established is a
Define the method called getstringinput( ) using the method : Define the method called getStringInput( ) using the method header
Explain reaction of iodine atoms to form i2 : For the reaction of iodine atoms to form I2, the experimental rate law is Rate = k[I]^2. What are the units for k if the unit of time is seconds
Find the electric field strengths at the cells surfaces : A study shows that mammalian red blood cells (RBCs) carry electric charge resulting from 4.4 million (rabbit cells) to 15 million (human cells) excess electrons spread over their surfaces
Compute how much work is done by the outside force : Equipotential surface A has a potential of 5650 V, while equipotential surface B has a potential of 7850 V. How much work is done by the outside force in moving the particle from A to B
Explain the initial amount of the reactant to be consumed : ^188 W decays by first order with a rate constant of 1.00 x 10^-2 d^-1. How long will it take for 93% of the initial amount of the reactant to be consumed

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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