Java I: Create a Java program that will accept the price of an item and the quantity being purchased of that item. After accepting the input, calculate the amount of the purchase (based on the price and quantity), calculate the sales tax on the purchase, then output the product price, quantity, subtotal, sales tax, and the total sale based on the output format shown below.
Structure your file name and class name on the following pattern:
The first three letters of your last name (begin with upper case.).
Then the first two letters of your first name (begin with upper case.).
Follow this with the name of the program: ProductSales.
For a student called ’John Doe,’ the class name and file name would be: DoeJoProductSales
--------------------------------------
Name the program ProductSales and format the title as described above by incorporating your name.
Use good comments:
Write a good description of what the program does.
Use comments within the code as well, especially on calculations and other areas that might need some explanation.
Think about the problem and decide what type each of the input numbers should be. Also, think about the calculations and decide what type the variables should be that will hold the results of the calculations.
Use camel casing for variable names, and use descriptive variable names. This time I will take points off for variable names like "tax" or "total."
Prompt the user with a statement asking for each of the input values. Clearly express what the user is to enter. Each prompt will be a simple text statement that will appear just prior to the input of the number.
Label all output to match the Output Format section below.
Use the printf() method to format the output of the dollar amounts.
Tip
Tip #1
The sales tax amount should be a constant in the program and does not need to be input. Set that constant equal to 0.06 and use that constant variable in the calculation.
Tip
Tip #2
Other than the quantity, the variables in this program will hold dollar amounts. Therefore, be sure that your variable types will hold dollar amounts (dollars and cents), and that the variables to hold the results of calculations will hold those types as well.
--------------------
3.2. Output Format
Format the output to look similar to the following:
The 9s simply indicate where numbers will be. There will not always be a number for each 9, except for the cents in the dollar amounts.
***** Product Sale Calculations *****
Product price: $9.99
Number of units purchased: 9
Subtotal: $99.99
Sale tax on purchase: $99.99
Final Sale amount: $99.99