Asked by LockShift
Your city's Parking Violation 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 fine of $20, type C carries a fine of $30, and type D carries a fine of $50. The program should ask for a number of type A violations, the number of type B violations, and so on. If the number of type A, B, or C violations exceeds 10, impose an additional fine of $50 for each category that exceeds 10. If the total number of type A,B, or C exceeds 20 but none of types A,B or C individually exceeds 10, impose an additional fine of $75. If the number of type D violations exceeds three, impose an additional fine of $20 for each type D violation over three. The program should display the total fine for the person. The program should process any number of persons.
I'm just a beginner. Please help me with the Input using TC3. I didn't start it yet.
I'm just a beginner. Please help me with the Input using TC3. I didn't start it yet.
Answers
Answered by
kenyo
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int fineA=10,fineB=20,fineC=30,fineD=50;
int ABC,result,result1,total;
int typeA,typeB,typeC,typeD;
int totalfineA,totalfineB,totalfineC,totalfineD;
char q;
do
{
cout<<"Enter total number of A violations: ";
cin>>typeA;
if(typeA>10)
totalfineA=(typeA*fineA+50);
else
totalfineA=(typeA*fineA);
cout<<"Enter total number of B violations: ";
cin>>typeB;
if(typeB>10)
totalfineB = (typeB*fineB+50);
else
totalfineB = (typeB*fineB);
cout<<"Enter total number of C violations: ";
cin>>typeC;
if(typeC>10)
totalfineC = (typeC*fineC+50);
else
totalfineC = (typeC*fineC);
result1=(totalfineA+totalfineB+totalfineC);
ABC=(typeA+typeB+typeC);
if ( ABC>20 )
{
result=result1;
if (typeA<10)
{
result=result1;
if (typeB<10)
{
result=result1;
if (typeC<10)
{
result=(result1+75);
}
else
{
result=result1;
}
}
else
{
result=result1;
}
}
else
{
result=result1;
}
}
else
{
result=result1;
}
cout<<"Enter total number of D violations: ";
cin>>typeD;
if ( typeD>3 )
totalfineD=(typeD*fineD)+(typeD*20);
else
totalfineD=(typeD*fineD);
total = (result+totalfineD);
cout<<"\n";
cout<<"The total fine is: $"<<total<<endl;
cout<<"\n\nDo you want to process another person ? (Y or N): ";
cin>>q;
cout<<"\n";
}
while(q!='N'&&q!='n');
cout<<"Press enter to quit the program!!!";
getch();
}
#include<conio.h>
void main()
{
clrscr();
int fineA=10,fineB=20,fineC=30,fineD=50;
int ABC,result,result1,total;
int typeA,typeB,typeC,typeD;
int totalfineA,totalfineB,totalfineC,totalfineD;
char q;
do
{
cout<<"Enter total number of A violations: ";
cin>>typeA;
if(typeA>10)
totalfineA=(typeA*fineA+50);
else
totalfineA=(typeA*fineA);
cout<<"Enter total number of B violations: ";
cin>>typeB;
if(typeB>10)
totalfineB = (typeB*fineB+50);
else
totalfineB = (typeB*fineB);
cout<<"Enter total number of C violations: ";
cin>>typeC;
if(typeC>10)
totalfineC = (typeC*fineC+50);
else
totalfineC = (typeC*fineC);
result1=(totalfineA+totalfineB+totalfineC);
ABC=(typeA+typeB+typeC);
if ( ABC>20 )
{
result=result1;
if (typeA<10)
{
result=result1;
if (typeB<10)
{
result=result1;
if (typeC<10)
{
result=(result1+75);
}
else
{
result=result1;
}
}
else
{
result=result1;
}
}
else
{
result=result1;
}
}
else
{
result=result1;
}
cout<<"Enter total number of D violations: ";
cin>>typeD;
if ( typeD>3 )
totalfineD=(typeD*fineD)+(typeD*20);
else
totalfineD=(typeD*fineD);
total = (result+totalfineD);
cout<<"\n";
cout<<"The total fine is: $"<<total<<endl;
cout<<"\n\nDo you want to process another person ? (Y or N): ";
cin>>q;
cout<<"\n";
}
while(q!='N'&&q!='n');
cout<<"Press enter to quit the program!!!";
getch();
}
There are no AI answers yet. The ability to request AI answers is coming soon!
Submit Your Answer
We prioritize human answers over AI answers.
If you are human, and you can answer this question, please submit your answer.