Question: write a java program that create an array and fill it with four drivers. Write a function to print all the drivers in the array
write a java program that create an array and fill it with four drivers.
Write a function to print all the drivers in the array using a tostring method in Driver. Call it
Write a method in Driver that will update the license expiry year. The method should ensure that the expiry year can only increase, and not decrease. Update some of the expiry years. Print the drivers again to show the updates
Now connect cars and drivers:
Add a driver instance variable to Car. Initially, cars have no drivers. Add a setter method to Car change a car's driver.
Assign drivers to cars, ensuring that some drivers are assigned to more than one car, and some cars have no drivers assigned to them likely meaning that nobody owns them, yet
Print all the cars. The drivers should be printed as well; for cars with no drivers, use the message No driver" rather than null. This will require additional processing in the Car's tostring
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
