Create a package Vehicles (a sub-directory under the working directory) that holds the

时间:2013-11-20 07:52:34
【文件属性】:
文件名称:Create a package Vehicles (a sub-directory under the working directory) that holds the
文件大小:2KB
文件格式:JAVA
更新时间:2013-11-20 07:52:34
Vehicles Define an abstract class Vehicle in the file Vehicle.java, add data members that can hold the following information: Vehicle type (Car, Bus, Truck or Motor), Registration number (e.g. “ABC123”), engine number (e.g. “H123456789”), owner’s name (e.g. “David Fox”), due date (e.g. 01/01/2011), length (e.g. 5.4 meters), gross mass (e.g. 2500 kg). You may add necessary methods in the class defined above. Define inheritance classes Car, Bus, Truck and Motor in the files Car.java, Bus.java, Truck.java and Motor.java from the abstract class Vehicle. In addition, the class Car should contain data members that can hold the following information: Car type (should be one of Light, Small, Medium, Large, Hybrid, Luxury, Sport types), purchase price, and usage (private or business). Define necessary methods in the class Car. The class Bus should include data members that hold the following information: Bus type (should be one of Small, Medium, Large types), number of seats. Define necessary methods in the class Bus. The class Truck should contain data members that can hold the following information: Truck type (should be one of Light, Caravan, Trailer types), axis distance (e.g. 4.5 m) , price and usage (private or business). Define necessary methods in the class Truck. The class Motor holds extra information for price of the vehicle. Define necessary methods in the class Motor.

网友评论