Inputting data, using constants, calculating, and formatting
You are going to buy a new laptop. As a smart consumer, you are going to have to determine the actual price of the laptop and the how much you will pay for laptop.
The total price of the laptop consists of four things:
- The base price of the laptop
- The cost of the RAM and hard drive upgrade
- The disposal fee for the old laptop (for the lithium battery)
- The state sales tax
The disposal fee is constant for any laptop, regardless of the number of upgrades you select. This value is $12.50.
The state sales tax is 6% of the total price of the laptop and the upgrades; there is no tax on the disposal fee.
The down payment for the laptop is the 11% of the total cost of the laptop (purchase price + upgrades). The remaining amount will be financed. Note: the amount financed does not include the disposal fee and sales tax. These are paid separately at purchase time.
Write a program that does the following:
- Ask the user for the make and model of the laptop (for example Dell Inspiron 13). This should be at least two words.
- Ask the user for the base price of the laptop.
- Ask the user for the cost of the upgrades selected.
- Calculate the sales tax.
- Calculate the total cost (purchase price + upgrades + disposal fee + sales tax)
- Calculate the down payment based on the (purchase price + upgrades).
- Display the following:
- The make and model of the laptop
- The base price of the laptop
- The price of upgrades for the laptop
- The disposal fee for the laptop
- The sales tax for the laptop
- The total cost of the laptop
- The down payment for the laptop
- The total due at purchase time: Down payment + Sales tax + Disposal fee
- The total amount that will need to be paid after the down payment (finance amount)
Remember: all the costs are in dollars, so each value needs to be displayed with a dollar sign (“$”) and must be displayed to two decimal places. All the text should be left justified and all the costs should be right justified (with the decimal points lining up as shown in the sample output).
Constants are required and need to be used for the various calculations. Determine what constants your will need.
Be sure to get all the input then do all of the math (processing). Finally show all of the output.
Use the test data below. Create screenshots of your program (like below) using both sets of test data. Remember to use your own name. Submit the .cpp code file and the screen shots (.docx) files in Canvas.
Rubric:
- Program is neat, indented and contains comments (5 points)
- Constants are correctly declared, commented and used (5 points)
- Correct variable types are used. Variable names are meaningful. Variables are commented (5 points).
- Allow entry of two or more word laptop name (2 points)
- Allow entry of base price and upgrade cost (3 points)
- Proper calculation of sales tax, total cost, down payment and finance amount, and total due (10 points)
- Display of base price, upgrade price, disposal fee, sales tax, total cost, down payment total due at purchase, and finance amount. (5 points)
- Display include “$”, has two decimal places and is properly formatted (10 points)
- Program compiles and runs without crashing (5 points)


0 comments