Question: Java II: For this assignment, you will be designing a set of classes that simulate a police officer issuing speeding tickets. You need to implement

Java II:

For this assignment, you will be designing a set of classes that simulate a police officer issuing speeding tickets. You need to implement the following classes:

1. Car: This class should store the license plate and speed the car was going at.

a. It should have methods to set and get the license plate and speed

2. Street: This class should store the allowed speed.

3. Officer : This class should store the police officers name and badge number.

a. It should have a method to determine whether the car was speeding given the street or not .

b. It should have a method checkSpeed that examines a Streets speed limit and a Cars speed and returns a ticket if a ticket should be issued. If not, it should return null.

4. Ticket: This class should store the Car, Street and Officer involved. It should also store the fine amount.

a. It should have a method to get the info of the Car involved (license plate and speed it was going)

b. It should have a method to report the fine. The fine should be $100 + $5 for each mile over the speed limit.

c. It should have a method to get the info of the Officer who issued the ticket (name and badge)

5. Write a main method that:

a. Asks the user for the info for a Car, a Street and an Officer. Based on the info, determine whether a ticket should be issued or not.

b. Print out a message with the ticket info, if one was issued, or the message No ticket!, if no ticket was issued.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!