Write an application class that generates 6 objects randomly from either a Car, or a Truck, or a Bicycle class. Your generated objects will be stored in a RentedVehicle array.

Write a static method in your test class that takes an array of RentedVehicles and prints the following for each element of the array:
• if the object is a car print its name and the number of seats and cost.
• if it is a Truck, print its name and capacity and cost.
• if it is a Bicycle, print its name and how many days it is rented and cost.

1 answer

What is the question?

You probably know that we do not write the program for you. We will be glad to give you hints, and help you debug if you run into problems.

If you show us some of your work, we can get started from there.