- Create a class called Driver
- The class will have the following attribute:
- String name
- int age
- boolean commercialLicense.
- float drivingSpeedPerMin
- It would have the getters and setters.
- It would have a constructor with all 4 attributes.
- It would have a method with a return value called calculateTripTime,
- It will have 2 parameters:
- int distance
- boolean rushHour
- The method will calculate how many minutes it will take to make the trip depending on the distance and the driver.drivingSpeedPerMin. Return the number of mins. For example, if driver.drivingSpeedPerMin is 1.5 and distance is 3 then this method will return 2.
- Create a class called NewyorkTaxiDriver which inherits from Driver class.
- NewyorkTaxiDriver would have a constructor that has 3 parameters: name and age and drivingSpeedPerMin
- NewyorkTaxiDriver should pass true in for commercialLicense parameter. when calling parent’s constructor. Look at how we call parent’s constructor in the Monster class with Dragon class exercises.
- Create a class called RegularDriver which inherits from Driver class.
- RegularDriver would have a constructor that has 3 parameters: name, age and drivingSpeedPerMin.
- RegularDriver should pass false in for commercialLicense parameter. when calling parent’s constructor. Look at how we call parent’s constructor in the Monster class with Dragon class exercises.