Question: Question 2 Design a console application that will print the vehicle accidents report for a city. Make use of an abstract class named RoadAccidents that
Question
Design a console application that will print the vehicle accidents report for a city. Make use of an
abstract class named RoadAccidents that contains variables to store the vehicle type the city
where the accident occurred and the total number of accidents. Create a constructor that accepts
the vehicle type, city, and number of accidents as parameters. In this class also create get
methods to get the vehicle type, city, and number of accidents. The RoadAccidents class must
implement an IRoadAccidents interface that contains the following:
public interface IRoadAccidents
String getAccidentVehicleType;
String getCity;
int getAccidentTotal;
Create a subclass called RoadAccidentReport that extends the RoadAccidents class. The
RoadAccidentReport class must contain a constructor to accept the vehicle type, city, and number
of accidents as parameters. Write code for the printAccidentReport method, which prints the
vehicle type, city and the number of accidents that occurred.
Finally, write a RunApplication class to instantiate the RoadAccidentReport class. Sample output is
shown below, and you may use the same values to test your application.
Sample screenshot
Encer che accident vehicle cype: Caz
Enter the city for the vehicle accidents: Cape Town
Enter the total Car accidents for Cape Town:
VBHICLE ACCIDENT REPORT
VEHICLE TYPE: Car
CITY: Cape Town
ACCIDENI TOTAL:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
