Answered step by step
Verified Expert Solution
Question
1 Approved Answer
in java Please implement the following classes: Police, Driver, and Car. The objective is to create a system where the police can detect the speed
in java
Please implement the following classes: Police, Driver, and Car. The objective is to create a system where the police can detect the speed of a driver on the highway. You must handle exceptions as described below:
If the speed exceeds mph throw an "OverSpeedException".
If the speed limit is below mph throw an "UnderSpeedException".
If the car is an ambulance, throw an "EmergencyException".
Within the main function, create instances of Driver, Car, and Police classes. Call the detectSpeed method of the Police instance, passing two parameters: the Driver and Car instances.
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