Question
in java Please create classes: Police, Driver, and Car. The police detects the speed when driver drives his/her car on the highway. You need to
in java
Please create classes: Police, Driver, and Car. The police detects the speed when driver drives his/her car on the highway. You need to handle exceptions when you implement the system.
If speed is over 80 mph, throws OverSpeedException,
Else if the speed limit is lower than 50, throws UnderSpeedException,
Else if the car is ambulance, throws emergenceException.
Inside the main function, you need to create a driver, car and also Police instances.
Call the function named detectSpeed of the police instance by passing two parameters: Driver and car instance.
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