/**********************************************************************************
* PROGRAMMED BY : DAISY CONTRERAS
* CLASS : CSC 5
* SECTION : MW 2:20-5:30PM
* ASSIGNMENT : CHAPTER 2 QUESTION #8
**********************************************************************************
*
* LIST ITEMS PURCHASED AND COMPUTE THE SUBTOTAL AND TOTAL OF THE PURCHASE
* ________________________________________________________________________________
* This program lists the prices of items that are purchased along with the subtotal,
* sales tax, and the total.
*_________________________________________________________________________________
* INPUT
* price_item : the price of the item
* subtotal : the subtotal of all of the items that were purchased
* total : the total of all of the purchased items plus tax
*
* OUTPUT
* price_item : the price of the item
* subtotal : the subtotal of all of the items that were purchased
* total : the total of all of the purchased items plus tax
*
* *******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
float price_item1 = 12.95; //INPUT - price of item 1
float price_item2 = 24.95; //INPUT - price of item 2
float price_item3 = 6.95; //INPUT - price of item 3
float price_item4 = 14.95; //INPUT - price of item 4
float price_item5 = 3.95; //INPUT - price of item 5
float subtotal; //INPUT - subtotal of all items added
float sales_tax; //INPUT - sales tax percentage
float total; //INPUT - total of all items and tax added
// Compute the subtotal of all items purchased
subtotal = price_item1 + price_item2 + price_item3 + price_item4 + price_item5;
// Define sales tax percentage
sales_tax = 0.06;
// Compute the total
total = subtotal + (subtotal * sales_tax);
// List the prices of all items
cout << "Price of item 1: " << "$" << price_item1 << endl;
cout << "Price of item 2: " << "$" << price_item2 << endl;
cout << "Price of item 3: " << "$" << price_item3 << endl;
cout << "Price of item 4: " << "$" << price_item4 << endl;
cout << "Price of item 5: " << "$" << price_item5 << endl;
// Display the subtotal of the items purchased
cout << "Subtotal: " << "$" << subtotal << endl;
// Display the sales tax
cout << "Sales Tax: " << "$" << sales_tax << endl;
// Display the total of all items purchased with taxes included
cout << "Total: " << "$" << total << endl;
return 0;
}