Devin Dahlberg

C++ : Assignment One

// This program holds the prices of five items in variables and displays each items price, the subtotal of the sale, the amount of the sales tax, and the total. (Sales tax is 7%)
//
//
//Program from Starting Out With C++ from Control Structures through Objects (Ninth Edition) by Tony Gaddis(2018) pg. 82-83
//
// Programmed by Devin Dahlberg, CIS 251 Student
// January 16, 2024

#include <iostream>
using namespace std;

int main()
{

	double item1, item2, item3, item4, item5, subTotal, salesTax, total;

	// Get the price of item one
	cout << "What is the price of the first item? ";
	cin >> item1;

	// Get the price of item two
	cout << "What is the price of the second item? ";
	cin >> item2;

	// Get the price of item three
	cout << "What is the price of the third item? ";
	cin >> item3;

	// Get the price of item four
	cout << "What is the price of the fourth item? ";
	cin >> item4;

	// Get the price of item five
	cout << "What is the price of the fifth item? ";
	cin >> item5;

	// Get the subtotal of the sale
	subTotal = item1 + item2 + item3 + item4 + item5;

	// Get the sales tax of the sale
	salesTax = subTotal * 0.07;

	// Get the Total
	total = subTotal + salesTax;

	// Print the prices, subtotal, salestax, and total
	cout << "The price of the first item is: " << item1 << ".\n";
	cout << "The price of the second item is: " << item2 << ".\n";
	cout << "The price of the third item is: " << item3 << ".\n";
	cout << "The price of the fourth item is: " << item4 << ".\n";
	cout << "The price of the fifth item is: " << item5 << ".\n";
	cout << "The subtotal is: " << subTotal << ".\n";
	cout << "The sales tax is: " << salesTax << ".\n";
	cout << "The total is: " << total << ".\n";

	return 0;
}

image