Assignment No.6 (Composition)
Assignment No.6 (Composition)
Assignment #6
Due Date: Before Coming Class (6-12-2023, 9:30 am)
Instructor: Dr. Javid (1-01-2023)
Note: The deadline is hard, late submission and copied solutions will
credit zero marks. The Demos of this assignment will be conducted in the
lab class. (Comment your program properly, write down your Name,
Registration No. at the top of .cpp file in comments. Take care of indentation
when writing program.).
Task-1
Consider six classes i.e. Person, Professor, Researcher, Department, Laboratory, and University
having following specifications.
Task-2
A class named Processor has
• Two attributes i.e. processName and price
• A parameterized constructor to initialize attributes with user-defined values
Class MainMemory consists of
• Two attributes i.e. size and price
• A parameterized constructor to initialize attributes with user-defined values
Class MotherBoard has
• a data member named compName of type string
• a no-argument constructor to initialize with default name intel
Design a class named Computer that includes
• A data member named proc of type Processor
• A data member named ram of type MainMemory
• A data member named mboard of type MotherBoard
• A parameterized constructor that accept two arguments of type Processor and MainMemory to
initialize members of these types. Moreover, within this constructor, instantiate object of
MotherBoard to initialize mboard data field.
a) Write a main() and create necessary objects of the classes.
b) Draw UML diagram for each class and show inheritance, aggregation, and/or
composition relationship between these classes.