99 008
Assignments Done
99%
Successfully Done
In May 2021

# Answer to Question #16719 in C++ for Theodore Michael

Question #16719
Your city&rsquo;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 of $10, type B carries a fine of$20, type C carries a fine of $30, and a type D carries a fine of$50. The program should ask for the name of offender, the number of type A violations, the number of type B violations, and so on. Store the offenders name in a string object. The program should display the offenders name and the total fine for the person.
1
2012-10-17T10:26:36-0400
import java.util.Scanner;

public class Store {

public static void main(String[] args) {

Scanner in = new Scanner(System.in);

String name;

int violationA = 0, violationB = 0, violationC = 0, violationD = 0, total = 0;

System.out.println(&quot;Enter the offenders name: &quot;);

name = in.nextLine();

System.out.println(&quot;Validations A count: &quot;);

String tempQuantity = in.nextLine();

violationA += Integer.parseInt(tempQuantity) * 10;

total += violationA;

System.out.println(&quot;Validations B count: &quot;);

tempQuantity = in.nextLine();

violationB += Integer.parseInt(tempQuantity) * 20;

total += violationB;

System.out.println(&quot;Validations C count: &quot;);

tempQuantity = in.nextLine();

violationC += Integer.parseInt(tempQuantity) * 30;

total += violationC;

System.out.println(&quot;Validations D count: &quot;);

tempQuantity = in.nextLine();

violationD += Integer.parseInt(tempQuantity) * 50;

total += violationD;

System.out.println(&quot;Total fine of &quot; + name + &quot; : \$&quot; + total);

}

}

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!