Module 3 - Lab - University
Objective
The goal of this lab assignment is to bolster your understanding of object-oriented programming in Java, particularly the concept of aggregation. This is a powerful concept in object-oriented design where one class becomes a part of another class, but both can exist independently.
Instructions:
Create the
Course
class: This class will have the attributes:courseName
andcourseCode
.1.1. Both attributes will be set by user input.
1.2. Include appropriate getter and setter methods for these attributes.
Create the
Professor
class: This class will have the attributes:professorName
,department
, andcourse
.2.1. The
professorName
anddepartment
attributes will be set by user input.2.2. The
course
attribute will be an object of theCourse
class.2.3. Include appropriate getter and setter methods for these attributes.
Create the
University
class: This class will have the attributes:universityName
,location
, andprofessor
.3.1. The
universityName
andlocation
attributes will be set by user input.3.2. The
professor
attribute will be an object of theProfessor
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 course name and code, professor's name and department, and university's name and location.4.2. Instantiate the
Course
,Professor
, andUniversity
classes with the information provided by the user.4.3. Finally, output the information about the university, professor, and course in a neat and clear format.
Don't forget to follow best practices such as using appropriate naming convention, and including comments to describe your code.
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