In Problem 4, the Vehicle, Car, and Truck classes were implemented. Vehicles could include more such as
Question:
In Problem 4, the Vehicle, Car, and Truck classes were implemented. Vehicles could include more such as motorcycles, buses, trains, ships, and airplanes. Using UML diagrams, organize these vehicles. Add appropriate data members and methods in the diagram for each type of vehicle.
Data From Exercise 4
Write a class Vehicle which keeps a vehicle identification number, license plate number, and a number of axles. Derive two classes from the Vehicle class named Car and Truck. Include a data member for the number of passengers in the Car class and a data member for the towing capacity for the Truck class. All three classes should have a to String method to be able to output information about a particular vehicle.
Step by Step Answer:
Guide To Java A Concise Introduction To Programming
ISBN: 978-3031228414
2nd Edition
Authors: James T. Streib, Takako Soma