/*Date: 02/04/08 Programming Fundamentals II Homework Assignment Chapter 3-Question #3.11 Monthly Sales Tax - 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, sales plus sales tax). Assume the state sales tax is 4 percent and the county sales tax is 2 percent. If the total amount collected is known and the total sales tax is 6 percent, the amount of product sales may be calculated S=T/1.06 where S is the product sales and T is the total income (product sales plus sales tax). */ #include //needed for cout and cin (input and output) #include //needed to use stream manipulators #include //needed to use string variable using namespace std; //provides access to std namespace int main()//beginning of main function {//beginning of the function main string month, year;//creates string variables to hold month and year double sales,//creates double variable to hold sales, after taxes state = .04,//creates double var for state tax rate county = .02,//creates double var for county tax rate total = state + county,//creates total tax rate adding state & county collected; //creates double var to hold collected amount-from register cout << "Monthly Sales Tax Report.\n";//welcomes user cout << "Please enter the Month.\n";//asks user for month cin >> month;//saves month in string cout << "Please enter the year.\n";//asks user for year cin >> year;//saves year in string cout << "Please enter total monthly sales from register.\n";//asks user sales cin >> collected;//saves collected sales in double cout << "-------------------------------\n";//draws line cout << "Month: " << month << " " << year << endl;//shows month and year for report cout << "-------------------------------\n";//draws line sales = collected/(1+total);//figures sales from collected, total is total tax rate cout << left << setw(18) << "Total Collected:"//creates 1st column shows title << left << setw(1) << "$"//creats column with 1 space to hold $ << right << setw(12) << fixed << setprecision(2) << collected << endl; //figures solution with 2 numbers to the right of decimal cout << left << setw(18) << "Sales:"//creates 1st column shows title << left << setw(1) << "$"//creats column with 1 space to hold $ << right << setw(12) << fixed << setprecision(2) << sales << endl; //figures solution with 2 numbers to the right of decimal cout << left << setw(18) << "County Sales Tax:"//creates 1st column shows title << left << setw(1) << "$"//creats column with 1 space to hold $ << right << setw(12) << fixed << setprecision(2) << sales*county << endl; //figures solution with 2 numbers to the right of decimal cout << left << setw(18) << "State Sales Tax:"//creates 1st column shows title << left << setw(1) << "$"//creats column with 1 space to hold $ << right << setw(12) << fixed << setprecision(2) << sales*state << endl; //figures solution with 2 numbers to the right of decimal cout << left << setw(18) << "Total Sales Tax"//creates 1st column shows title << left << setw(1) << "$"//creats column with 1 space to hold $ << right << setw(12) << fixed << setprecision(2) << sales*total << endl; //figures solution with 2 numbers to the right of decimal return 0;//returns int of 0 for main() to end program }//end of the function main