Module 3 - Lab - Dealership
Objective
The primary objective of this lab assignment is to strengthen your understanding of object-oriented programming in Java, with an emphasis on the concept of aggregation. The theme for this assignment revolves around cars and their various components. As always, you will make use of the Scanner
class to collect user input.
Instructions:
Create the
Engine
class: This class will have the attributes:engineType
,horsePower
, andfuelType
.1.1. All attributes will be set by user input.
1.2. Include appropriate getter and setter methods for these attributes.
Create the
Car
class: This class will have the attributes:carMake
,carModel
,carYear
, andengine
.2.1. The
carMake
,carModel
, andcarYear
attributes will be set by user input.2.2. The
engine
attribute will be an object of theEngine
class.2.3. Include appropriate getter and setter methods for these attributes.
Create the
Dealership
class: This class will have the attributes:dealershipName
,location
, andcar
.3.1. The
dealershipName
andlocation
attributes will be set by user input.3.2. The
car
attribute will be an object of theCar
class.3.3. Include appropriate getter and setter methods for these attributes.
Write your main program:
4.1. Use the
Scanner
class to collect user input for the engine's type, horsepower, and fuel type, the car's make, model, and year, and the dealership's name and location.4.2. Instantiate the
Engine
,Car
, andDealership
classes with the information provided by the user.4.3. Finally, output the information about the dealership, the car, and its engine in a clear and descriptive format.
Remember to adhere to best practices for clean, efficient code, such as using appropriate naming conventions, encapsulation, using constants instead of hard-coded values where possible, and including comments to explain your code. Good luck!
Note: Use Copy constructors where appropriate
Deliverables
Upload the following files in a zip folder that you have created:
Java class files
Screenshot of the Console with the code executing
COSC-1437 / ITSE-2457 Computer Science Dept. - Author: Dr. Kevin Roark