// Cameron Pham CS1A chapter 2, p. 82, #8
//
/******************************************************************************
*
* Displaying Item Prices, Subtotal of Sale, Amount of Sales Tax, and Total Cost
*
* _____________________________________________________________________________
* This program computes and displays a customer's purchase in a store
* purchase five items. It displays the prices of five items, computes the
* subtotal of the sale, amount of sales tax, and the total cost of the sale.
*
* Computation is based on the formula:
* subtotalSale = item1 + item2 + item3+ item4 + item5
* salesTaxAmount = subtotalSale * salesTax
* totalSale = subtotalSale + salesTaxAmount
* _____________________________________________________________________________
* INPUT
* item1 = $12.95 (cost of item)
* item2 = $24.95 (cost of item)
* item3 = $6.95 (cost of item)
* item4 = 14.95 (cost of item)
* item5 = $3.95 (cost of item)
* salesTax = 6% (tax rate percentage)
*
* OUTPUT
* subtotalSale = charge of all items before tax
* salesTaxAmount = charge of tax
* totalSale = charge of items after tax is added
*
* ****************************************************************************/
#include <iostream>
using namespace std;
int main() {
double item1; // INPUT - The cost of item
double item2; // INPUT - The cost of item
double item3; // INPUT - The cost of item
double item4; // INPUT - The cost of item
double item5; // INPUT - The cost of item
double salesTax; //INPUT - tax rate percentage
double subtotalSale; // OUTPUT - The sale cost before tax
double salesTaxAmount; // OUTPUT - The charge of tax
double totalSale; // OUTPUT - The total sale cost after tax
// Initializing Program Variables
item1 = 12.95;
item2 = 24.95;
item3 = 6.95;
item4 = 14.95;
item5 = 3.95;
salesTax = 0.06;
// Computing Sales
subtotalSale = item1 + item2 + item3 + item4 + item5;
salesTaxAmount = subtotalSale * salesTax;
totalSale = subtotalSale + salesTaxAmount;
// Final Output
cout << "Price of item 1 = $ " << item1 << endl;
cout << "Price of item 2 = $ " << item2 << endl;
cout << "Price of item 3 = $ " << item3 << endl;
cout << "Price of item 4 = $ " << item4 << endl;
cout << "Price of item 5 = $ " << item5 << endl;
cout << "Subtotal = $ " << subtotalSale << endl;
cout << "Amount of sales tax = $ " << salesTaxAmount << endl;
cout << "Total cost = $ " << totalSale << endl;
return 0;
}