Professional Documents
Culture Documents
Lab 04 PDF
Lab 04 PDF
Composition
1. Create a class Course. The course has course code, course name, and number of
credit hours. The instance variables are initialized through a constructor. Create the
setter and getter methods for all the variables. Write a toString method that displays
the course details in the following format:
2. Create a class Faculty. A faculty member has a name, monthly salary, one or more
courses, and the number of credit hours. A faculty member is allocated more than
12 credit hours, he or she is paid PKR2800 extra per credit hour per month. Create
a constructor to initialize the variables, the setter and getter and other appropriate
methods required. Use composition to include the course details in the Faculty class.
Write a toString method to display the faculty and course details in the following
format.
3. Write a client class that initializes and prints the objects of the two classes.