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:

  1. Create the Engine class: This class will have the attributes: engineType, horsePower, and fuelType.

    1.1. All attributes will be set by user input.

    1.2. Include appropriate getter and setter methods for these attributes.

  2. Create the Car class: This class will have the attributes: carMake, carModel, carYear, and engine.

    2.1. The carMake, carModel, and carYear attributes will be set by user input.

    2.2. The engine attribute will be an object of the Engine class.

    2.3. Include appropriate getter and setter methods for these attributes.

  3. Create the Dealership class: This class will have the attributes: dealershipName, location, and car.

    3.1. The dealershipName and location attributes will be set by user input.

    3.2. The car attribute will be an object of the Car class.

    3.3. Include appropriate getter and setter methods for these attributes.

  4. 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, and Dealership 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:

  1. Java class files

  2. Screenshot of the Console with the code executing

 

COSC-1437 / ITSE-2457 Computer Science Dept. - Author: Dr. Kevin Roark