Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

identify current issues relating to equal pay in organisations

Answered: 1 week ago