Nt1310 Unit 6 Programming Assignment

Words: 925
Pages: 4

Programming Assignment Unit 6 University of the People CS 1102 – 01: Programming 1 Mudasir Ashraf Bhat Mar 14th, 2024.

Programming Assignment Unit 6 Design Overview The program uses interfaces and inheritance to model different kinds of vehicles. A basic interface Vehicle describes the common characteristics of all vehicles: make, model, and year. Three distinct interfaces extend Vehicle: CarVehicle: Car-specific attributes such as number of doors and fuel type. MotorVehicle: A motorcycle-specific term that includes parameters such as the number of wheels and the type. Truck Vehicle: Truck-specific features, including load capacity (in tons) and transmission type. Three concrete classes implement the corresponding interfaces: Car: A vehicle with a certain
…show more content…
Car-Vehicle Interface (extends Vehicle): It inherits common attributes from Vehicle. Defines methods to set and get a car's number of doors and fuel type. MotorVehicle Interface (extends Vehicle): It inherits common attributes from Vehicle. Defines methods to set and get the number and type of wheels for a motorcycle. Truck-Vehicle Interface (extends Vehicle): It inherits common attributes from the vehicle. Defines methods to set and get a truck's cargo capacity (in tons) and transmission type. Car Class (Implements CarVehicle): Represents a vehicle by its make, model, year, number of doors, and fuel type. Provides constructors and methods for managing car attributes. Motorcycle Class (Implements Motor Vehicle): Represents a motorcycle by its make, model, year, number of wheels, and type. Provides constructors and methods for managing motorcycle attributes. Truck Class (Implements Truck Vehicle): A truck object is represented by its make, model, year, cargo capacity, and transmission type. Provides constructors and methods for managing vehicle attributes. Main Class: The Main class demonstrates how to create and use automobile, motorcycle, and truck objects. It prompts the user