Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Your city\'s Parking Violation Bureau wants you to write a program to compute fi

ID: 3546562 • Letter: Y

Question

Your city's Parking Violation Bureau wants you to write a program to compute fines for parking violations. There are ffour 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 name of the offender , the number of type A violations, The number of type B violations, and do on. Store the offender's name in a string object. The program should display the offender's name and the total fine for the person.

Explanation / Answer

#include "stdafx.h"

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

const double TYPEA = 10, TYPEB = 20, TYPEC = 30, TYPED = 50;

double result1, result2, Total,typeA, typeB, typeC, typeD, finA, finB, finC;

finC=0;

cout << setprecision(2)

<< setiosflags(ios::fixed)

<< setiosflags(ios::showpoint);

// 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;

system ("PAUSE");

return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote