Question
IN JAVA PLEASE WITH COMMENTS!!! Need final driver to take in user input for speed You will design a set of classes that work together
IN JAVA PLEASE WITH COMMENTS!!! Need final driver to take in user input for speed
You will design a set of classes that work together to simulate a police officer issuing a speeding ticket. You should design the following classes:
***IN JAVA PLEASE***
The Car Class: This class should simulate a car. The classs responsibilities are as follows:
To know the cars make, model, color, license number, and the speed the car is traveling.
The SpeedingTicket Class: This class should simulate a speeding ticket. The classs responsibilities are as follows:
To report the current speed limit.
To report the make, model, color, and license number of the illegally speeding car.
To report the amount of the fine, which is $250, plus $100 if the car is going 10 mph or more over the current speed limit.
To report the name and badge number of the police officer issuing the ticket.
The PoliceOfficer Class: This class should simulate a police officer inspecting speeding cars. The classs responsibilities are as follows:
To know the police officers name and badge number.
To examine a Car object and the current speed limit, and determine whether the cars speed has exceeded the posted speed limit.
To issue a speeding ticket (generate a SpeedingTicket object) if the cars speed has exceeded the current speed limit. If the car's speed has not exceeded the current speed limit, no SpeedingTicket object should be created.
Finally, write a driver class that takes in the speed of the car from the user. Based on that speed, let the user know whether the Police Officer has issued them a ticket and the amount of the fine.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started