C++ Assignment (Aggregation,Association and Composition)


Question 1 
Consider the class diagram in Figure 1 which illustrates the data model for supervisions of student projects. Each student can only have a project and is supervised by a lecturer.

Write a complete C++ program based on the following tasks:

1. Class Project has the following methods:
 a. the constructor
b. getSupervisor
c. setSupervisor

2. Class Student has the following methods:
a. the constructor
 b. setName
 c. setProject
d. assignSupervisor
e. print: to display the student’s name and project’s title, and also the supervisor’s name (but only if the student has a supervisor). 

 3. Create two objects of Lecturer for “Dr. Ali Bakar” and “Prof. Dr. Abu Samah Abdullah”.

4. Then create an array of objects of Student with maximum number of students to store into the array is 15.

5. Read a list of students consisting of names and project titles, from an input file and store them into an array.                                                                                               

6. Assign supervisors to students as follows: a. The first lecturer is assigned to be the supervisor for the first and second students. b. The second lecturer is assigned to the last student.   
 7. Print all the students. The screen output should look like as in Figure 2 and Figure 3.


Solution


output

Post a Comment

0 Comments