Write a java program that can be used to calculate and


Purpose of exercise: To understand and implement the selection constructs.

Write a Java program that can be used to calculate and notify violators of the fines and/consequences for road traffic breaches as shown in the schedule below.

Non-Moving Violation

  • No driver's license

$25.00

  • Expired tag

$20.00

  • No registration

$20.00

  • No insurance

$10.00

Moving Violation

• Speeding violation or speeding in construction zone Miles over the Speed Limit1 - 5 MPH Warning
6 - 9 MPH      $130.00
10 - 14 MPH   $205.00
15 - 19 MPH   $405.00
20 - 29 MPH   $455.00
30 MPH or over appearance   $605.00 and court

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 school
zone, or speeding in toll facility, but not both.
- One kind of moving violation only, for excess speeding, or speeding in construction zone, but not both.
- One kind of moving violation for speeding in school zone, or speeding in toll facility, but not
both.

In formulating your solution:

(a) Write a class called TrafficViolations 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 statement to determine the miles, and the switch statement for the other criteria.

Solution Preview :

Prepared by a verified Expert
JAVA Programming: Write a java program that can be used to calculate and
Reference No:- TGS02392142

Now Priced at $20 (50% Discount)

Recommended (90%)

Rated (4.3/5)