Write a class called traffic violations

Write a Java program that can be used to calculate and notify violators of the fines and/consequences forroad traffic breaches as shown in the schedule below.The violation notice may comprise of any of the following:

  • One or more of non-moving violations alone.
  • Combination of non-moving violations, and one kind of moving violation for excess speeding,or speeding in construction zone, but not both.
  • Combination of non-moving violations, and one kind of moving violation for speeding in schoolzone, or speeding in toll facility, but not both.
  • One kind of moving violation only, for excess speeding, or speeding in construction zone, butnot both.
  • One kind of moving violation for speeding in school zone, or speeding in toll facility, but notboth.

In formulating your solution:

(a) Write a class called Traffic Violations that determines types of traffic violations.

(b) Write a test class called TestTrafficViolations that implements the class TrafficViolations.

(c) Demonstrate knowledge of the if statement and the switch statement by using the if/else statementto determine the miles, and the switch statement for the other criteria.

Leave a Reply

Your email address will not be published. Required fields are marked *