Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

Students also viewed these Databases questions

Question

Q.1. Taxonomic classification of peafowl, Tiger and cow ?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago