A local retailer has hired you to write a program to calculate the total cost of a customer's purchase. The customer may purchase Snaps, Red Hots, or Mike-N-Ikes. Snaps are sold for $1.60 a box, Red Hots for $1.20 a box, and Mike-N-Ikes for $1.80 a box. A sales tax of 5% is added to the total cost of the candy.
Write a Java program that satisfies the above description.
Requirements:
The number of Snaps, Red Hots, and Mike-N-Ikes must each be obtained from the user and stored in an appropriately typed local variable.
The correct pre-tax subtotal must be calculated and returned by a static method and stored in an appropriately typed local variable in main.
The correct tax must be calculated and returned by a static method and stored in an appropriately typed local variable in main.
The pretax subtotal, tax, and total cost must be displayed to the user in a reasonable report format by a static void method.
Sample run:
Enter the number of Snaps to purchase: 10
Enter the number of Red Hots to purchase: 10
Enter the number of Mike-N-Ikes to purchase: 0
Subtotal: $28
Tax: $1.4
Total: $29.4