Consider six classes i.e. Person, Professor, Researcher, Department, Laboratory, and University having following specifications. Class University has
Question:
Consider six classes i.e. Person, Professor, Researcher, Department, Laboratory, and University having following specifications.
Class University has
• Two attributes of type string i.e. universityName and location • An attribute named dept of type Department
Class Department has
•Two attributes i.e. deptID, deptName
• A two-argument constructor to initialize data fields with user-defined values • A member function display() to show all attribute values
Class Laboratory contains
•Two attributes i.e. labID and experimentNo
•A two-argument constructor to initialize data member with user-defined values
Class Person has
•Two attributes i.e. name and age
• A parameterized constructor to initialize attributes with user-defined values • A member function display() to show its attribute values
Class Professor is derived from class Person and has
•A data field named profName of type string
•A data field named dept of type Department
•A two-argument constructor to initialize both attributes of user-defined values
Class Researcher is derived from class Professor and has
•An additional attribute named lab of type Laboratory
•A constructor to initialize lab with user-defined value
a)Draw UML diagram for each class and show inheritance, aggregation, and composition relationship between these classes.
b)Implement all these classes while illustrating the concept of aggregation and composition in terms of ownership and life-cycle.
Introduction to Operations Research
ISBN: 978-1259162985
10th edition
Authors: Frederick S. Hillier, Gerald J. Lieberman