Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access with AI-Powered 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