Your city's Parking Violations Bureau wants you to write a program for computer fines for parking violations. There are four types of violations: type A car carries a fine of $10,type B carries a find 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,B or C 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$50 fine for each category that exceeds 10. If the total number of type A,B or individually exceeds 10, impose and additional fine of$75. If the number of type D violations exceeds 3, 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.
1
Expert's answer
2012-10-05T09:03:20-0400
#include "stdafx.h" #include <iostream> #include <iomanip> using namespace std;
// Obtain Input result1=0; cout << "Enter total number of A violations: "; cin >> typeA; if (typeA >= 10) finA = (typeA * TYPEA + 50); else finA = (typeA * TYPEA);
cout << "Enter total number of B violations: "; cin >> typeB; if (typeB >= 10) finB = (typeB * TYPEB + 50); else finB = (typeB * TYPEB);
cout << "Enter total number of C violations: "; cin >> typeC; if (typeC >= 10) finC = (typeC * TYPEC + 50); else finA = (typeC * TYPEC);
result1 = (finA + finB + finC);
if (result1 >= 20) (result1 + 75);
cout << "Enter total number of D violations: "; cin >> typeD; result2=0; if (typeD >= 3) (typeD * TYPED + 20); else{ result2 = (typeD + TYPED); }
//Display results
cout << endl << endl; cout << "The total fine for A, B, and C violations is " << result1 << endl; cout << "The total fine for D violations is " << result2 << endl;
Total = (result1 + result2);
cout << "The total of all violations:" << Total << endl;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
"assignmentexpert.com" is professional group of people in Math subjects! They did assignments in very high level of mathematical modelling in the best quality. Thanks a lot
Comments
Leave a comment