Answer to Question #12071 in C++ for Jennifer

Question #12071
I need help with this program. I do not even know where to begin. Can somebody please help me figure out how to start the program, anything helps

Your city's parking bureau wants you to write a program to compute fines for parking violations. There are four types of violation: type A carries a fine of $10, type B carries a fine of $20, type C carries a fine of $30, and type D carries a fine of $50. The program should ask for the number of type A violations, the number of type B violations, and so on. The program should display the total fine for the person.
1
Expert's answer
2012-07-24T11:45:23-0400
#include <iostream>
using namespace std;
int _tmain(int argc,
_TCHAR* argv[])
{
int sum=0;
int buf=0;
cout<<"Enter number of
A violations:\n";
cin>>buf;
sum=sum+buf*10;
cout<<"Enter
number of B
violations:\n";
cin>>buf;
sum=sum+buf*20;
cout<<"Enter
number of C
violations:\n";
cin>>buf;
sum=sum+buf*30;
cout<<"Enter
number of D
violations:\n";
cin>>buf;
sum=sum+buf*50;
cout<<"Total fine
is "<<sum<<" ";
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS