Introduction (Monthly Sales Tax)
- Due:
- 11:00pm, Friday September 17, 2021
Description
A retail company must file a monthly sales tax report listing the sales for the month and the amount of sales tax collected. Write a program that asks for the month, the year, and the total amount collected at the cash register (that is, product sales plus sales tax). Assume the company is operating in San Francisco where the sales tax is split between the state, county and an additional special local tax. The state sales tax is 6%, the county sales tax is 0.25%, and the special tax is 2.25%.
If the total amount collected is known and the total sales tax is 8.5%, the amount of product sales is calculated using the formula:
$$S = \frac{T}{1.085}$$
where S is the product sales and T is the total income (product sales plus sales tax)
The program should display a report similar to
Month: September
Year: 2021
Total Collected: $108.50
Product Sales: $100.00
State Sales Tax: $6.00
County Sales Tax: $0.25
Special Tax: $2.25
Total Sales Tax: $8.50
Instructions
To start the assignment, login to your university Linux account and copy the assignment code to a location under your home directory. The assignment code is located at:
/export/home/public/schwesin/csc135/projects/project1-handout
You can copy a directory with the cp -r
command.
You need to edit the program_plan.txt
and p1.cpp
files. Do not change the names of those files.
To submit your assignment, execute the following command from within your project1-handout
directory:
~schwesin/bin/submit csc135 project1
Notes
Here are the main things you need to know for this assignment:
How to log into the Linux server
How to copy a directory on the Linux server
cp -r <source directory> <destination directory>
How to edit text files with a text editor;
nano
is a good one for beginnersHow to compile the program
g++ p1.cpp
How to run the program
./a.out
How to declare variables
Examples:
int x; // a variable named x of type int double y; // a variable named y of type double string s; // a variable named s of type string
How to get input from the user and store it in a variable
Examples:
cin >> x; // attempt to read input into x cin >> y; // attempt to read input into y cin >> s; // attempt to read input into s
How to print output to the console
Examples:
cout << "Hello"; cout << x << endl;
How to configure floating point output to have two places after the decimal point.
Add
#include <iomanip>
at the top of the file.Before printing any output configure
cout
:cout << fixed << showpoint; cout << setprecision(2);