-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathA6monthlycollection.cpp
51 lines (40 loc) · 1.71 KB
/
A6monthlycollection.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// The program gets the monthly collection and prints out its details
// By Emily Dayanghirang
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const double STATE_SALES_TAX = 0.04;
const double COUNTY_SALES_TAX = 0.02;
const double TOTAL_SALES_TAX = STATE_SALES_TAX + COUNTY_SALES_TAX;
string month;
int year;
double total_amount_collected,
product_sales,
county_sales_tax_cost,
state_sales_tax_cost,
total_sales_tax_cost;
// Prompt user
cout << "What is the month of the collection? ";
getline(cin, month);
cout << "What is the year of the collection? ";
cin >> year;
cout << "What is the total amount collected at the cash register? ";
cin >> total_amount_collected;
// Calculations
product_sales = (total_amount_collected / (1.00 + TOTAL_SALES_TAX));
county_sales_tax_cost = (product_sales * COUNTY_SALES_TAX);
state_sales_tax_cost = (product_sales * STATE_SALES_TAX);
total_sales_tax_cost = county_sales_tax_cost + state_sales_tax_cost;
// Display the month's collection
cout << endl << setprecision(2) << fixed << showpoint
<< "Month: " << month << endl
<< "-------------------------" << endl
<< "Total Collected:" << setw(10) << "$" << setw(9) << total_amount_collected << endl
<< "Sales:" << setw(20) << "$" << setw(9) << product_sales << endl
<< "County Sales Tax:" << setw(9) << "$" << setw(9) << county_sales_tax_cost << endl
<< "State Sales Tax:" << setw(10) << "$" << setw(9) << state_sales_tax_cost << endl
<< "Total Sales Tax:" << setw(10) << "$" << setw(9) << total_sales_tax_cost << endl;
return 0;
}