Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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