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

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 19RQ
icon
Related questions
Question

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

 

Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT