Question: Java Program: Write a program that asks the user to enter an items wholesale cost and its markup percentage. It should then display the items
Java Program:
Write a program that asks the user to enter an items wholesale cost and its markup percentage. It should then display the items retail price. For example:
If an items wholesale cost is 5.00 and its markup percentage is 100 percent, then the items retail price is 10.00.
If an items wholesale cost is 5.00 and its markup percentage is 50 percent, then the items retail price is 7.50.
The program should have a method named calculateRetail that receives the wholesale cost and the markup percentage as arguments, and returns the retail price of the item.
Class name: RetailPriceCalculator
View required output
Test Case 1
| Standard Input |
|---|
10ENTER -1ENTER |
Please enter the wholesale cost or -1 exit: Please enter the markup percentage or -1 exit:
Test Case 2
| Standard Input |
|---|
100ENTER 100ENTER -1ENTER |
Please enter the wholesale cost or -1 exit: Please enter the markup percentage or -1 exit: The retail price is: 200.00 Please enter the wholesale cost or -1 exit:
Test Case 3
| Standard Input |
|---|
10ENTER 50ENTER 10ENTER 100ENTER 10ENTER -100ENTER -1ENTER |
Please enter the wholesale cost or -1 exit: Please enter the markup percentage or -1 exit: The retail price is: 15.00 Please enter the wholesale cost or -1 exit: Please enter the markup percentage or -1 exit: The retail price is: 20.00 Please enter the wholesale cost or -1 exit: Please enter the markup percentage or -1 exit: The retail price is: 0.00 Please enter the wholesale cost or -1 exit:
Test Case 4
| Standard Input |
|---|
-200ENTER 10ENTER -200ENTER 50ENTER -1ENTER |
Please enter the wholesale cost or -1 exit: Wholesale cost cannot be a negative value. Please enter the wholesale cost again or -1 exit: Please enter the markup percentage or -1 exit: Markup cannot be less than -100%. Please enter the markup again or -1 exit: The retail price is: 15.00 Please enter the wholesale cost or -1 exit:
Test Case 5
| Standard Input |
|---|
-1ENTER |
Please enter the wholesale cost or -1 exit:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
