Write a java program in which 1. Implement all these classes while illustrating the concept of aggregation and composition in terms of ownership and life-cycle. Consider six classes i.e. Person, 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
Write a java program in which
1. Implement all these classes while illustrating the concept of aggregation and composition in terms of ownership and life-cycle.
Consider six classes i.e. Person, 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
Step by step
Solved in 4 steps