1 COP2250 Assignment 5 Purpose of exercise: To understand and implement the selection constructs: (a) The if/else construct, (b) The switch, As they pertain to the Java programming language. Assignment: 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. 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. 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 Limit o 1 – 5 MPH Warning o 6 – 9 MPH $130.00 o 10 – 14 MPH $205.00 o 15 – 19 MPH $405.00 o 20 – 29 MPH $455.00 o 30 MPH or over $605.00 and court appearance • Speeding in school zone or speeding within a toll facility o 1 – 5 MPH $155.00 o 6 – 9 MPH $255.00 o 10 – 14 MPH $305.00 o 15 – 19 MPH $405.00 o 20 – 29 MPH $455.00 2 • 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. (d) You determine a suitable format for the output
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more