Hello everyone. I am taking a C++ program at my college.. and i find it pretty difficult honestly.. but, i have to get the hang of it due to my major. If someone could help with this problem It would be appreciated..

A retail company must file a monthly sales tax report listing tge 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 sales tax is 6 percent the amount of product sales may be calculated as:
S= T/1.06

S= product sales and T=total income(product sales plus sales tax)

## All 6 Replies

start here

``````#include <iostream>

int main()
{
}``````

You need to at least make an effort so we can see that you are trying. All the information you gave is a perfect start. Analyze and write a bit of code for each task that you program should perform.

``````#include<iostream>
#include<iomanip>
using namespace std;

int main ()
{
int month, year;
float totalCollected, Sales, CountySalesTax, StateSalesTax;
float TotalSalesTax;

std::cout<< " What is the Month:";
std::cin>>month;
std::cout<<"What is the year:";
std::cin>>year;
std::cout<<"What is the total amount collected at register:\$ ";
std::cin>>totalCollected;
std::cout<< setprecision (2) << fixed;
float sales=totalCollected/1.06;
CountySalesTax=sales*.02;
StateSalesTax=sales*.04;
TotalSalesTax=CountySalesTax+StateSalesTax;

std::cout<<"------------------"<<

std::cout<<"Total Collected:" << setw(8)<<totalCollected<<endl;
std::cout<<"Sales:"           << setw(8)<<sales<<endl;
std::cout<<"County Sales Tax:"<< setw(8)<<CountySalesTax<<endl;
std::cout<<"State Sales Tax:" << setw(8)<<StateSalesTax<<endl;
std::cout<<"Total Sales Tax:" << setw(8)<<TotalSalesTax<<endl;
system ("pause");
return 0;

}``````

Two: What is your problem with it?
Three: A cout is missing a parameter and a semicolon.

``````#include<iostream>
#include<iomanip>
using namespace std;

int main ()
{
int month, year;
float totalCollected, Sales, CountySalesTax, StateSalesTax;
float TotalSalesTax;

std::cout<< " What is the Month:";
std::cin>>month;
std::cout<<"What is the year:";
std::cin>>year;
std::cout<<"What is the total amount collected at register:\$ ";
std::cin>>totalCollected;
std::cout<< setprecision (2) << fixed;
float sales=totalCollected/1.06;
CountySalesTax=sales*.02;
StateSalesTax=sales*.04;
TotalSalesTax=CountySalesTax+StateSalesTax;

std::cout<<"------------------"<<

std::cout<<"Total Collected:" << setw(8)<<totalCollected<<endl;
std::cout<<"Sales:"           << setw(8)<<sales<<endl;
std::cout<<"County Sales Tax:"<< setw(8)<<CountySalesTax<<endl;
std::cout<<"State Sales Tax:" << setw(8)<<StateSalesTax<<endl;
std::cout<<"Total Sales Tax:" << setw(8)<<TotalSalesTax<<endl;
system ("pause");
return 0;

}``````

also don't use 'std::' before a namespace function if you already said using namespace std;
the point of saying using namespace std; is for the program to know you will be working with the namespace 'std' so you DONT have to put it in. If you don't define 'using namespace std;' then you DO have to put the std::

line 23 endl and semicolan are missing . erase line 3 and evrything else is fine

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.