Question
Write a program IN JAVA that prompts the user for the wholesale price and markup percentage of an item. The program should invoke a method
Write a program IN JAVA that prompts the user for the wholesale price and markup percentage of an item. The program should invoke a method to calculate the retail price of the item.
You will need:
A scanner object to read the wholesale price and the markup percentage (Note: make sure you let the user know how the percentage should be entered. If it is in a percent format like 25% it would need to be converted to decimal for calculations. If the user entered it as a decimal format then no conversion is necessary.)
Variables to store:
a. The wholesale price (as a double)
b. The markup (as a double convert if entered as a %
c. (Optional: The retail price, which stores the returned retail value from the method. Keep in mind that you can use the method call directly in an output statement.)
3. A NumberFormat object to display the retail price in currency format (Optional: you can also create a format for the percentage, but it is not as important.)
A method that:
Accepts 2 parameters the wholesale price and markup percentage
Calculates the retail price
Returns the retail price value
Comments where necessary
A sample of the output is shown below:
Enter the item's wholesale cost: 60 Enter the item's markup percentage (as a %): 75 The item's retail price (at a 75% markup) is $105.00
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started