Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question [100 Marks) A school wants to store information about its students joining a mentoring programme that the school currently runs. The students are divided
Question [100 Marks) A school wants to store information about its students joining a mentoring programme that the school currently runs. The students are divided into two groups, mentors and mentees. Mentors are more knowledgeable students and offer helps to mentees. Mentors are chosen from those students with good CPAs. They can mentor only one mentee maximum. Mentee's progress are kept track based on their levels, i.e., from level 1 to 5 where 5 indicates a mastery level. Besides, mentee's contact information will also be stored. Given a class diagaram that models the above problem in Figure 1 and the details about it the class diagram in Table 3. Answer the questions 1 to 3 below. Note: As for questions 1 and 2, write your answers on papers, and for question 3, write your program using any C++ IDE such as DevCpp. Use the codebase program provided, main.cpp. 1. Determine whether the following classes form any relationship to each other in the context of Object-Oriented Programming (OOP). If so, name the type of relationship, otherwise write No Relationship. a. Student and Mentor b. Mentor and Mentee c. Contact and Mentor d. Mentee and Contact e. Contact and Student f Mentee and Student (12 marks) 2. The problem given above involves several OOP concepts including inheritance and polymorphism. a. Explain TWO (2) main roles of the inheritance concept in the above problem. Indicate in which part of the class diagram these roles take place. (16 marks) b. Explain how the concept of polymorphism plays the role in the above problem. (10 marks) c. Identify TWO (2) methods that will be specified as polymorphic. Justify your answer. Finaly, explain how you are going to make these methods polymorphic. (12 marks) 3. Implement the class diagram in Ch. Separate the class definition from the class declaration within the same file. Accomplish the following tasks in your program. Write your code in the provided codebase program. Note that, some of the code has been given in the codebase program. a. Complete the declaration of all classes. (12 marks) b. Define all the methods of the class Student. ( 6 marks) c. Define all the methods of the class Mentee. (5 marks) d. Define all the methods of the class Mentor. (13 marks) e. In the main function, declare two arrays below: an array of mentees an array of mentors and initialize the arrays with the sample data given in Table 1 and Table 2. (5 marks) Table 1: Sample data for mentee students No Mentee's name Email Phone 1 Abdul Samad asamad892@gmail.com 013-89001000 2 Siti Nurdiana ct. nur@yahoo.com 011-123013456 Level 2 2 2 Table 2: Sample data for mentor students No Mentor's name Expertise 1 Ahmad Kamal Web Programming Siti Aminah Java and C++ 2 f. Declare another array to hold a list of students and fill in the array with all the mentees and mentors created in 3(e). (3 marks) g. Using a loop, print the list created in 3(t). The output should look like as in Figure 2. (2 marks) h. Using the array created in 3(e), assign the second mentee to the second mentor. (1 mark) 1. Using a loop and the array created in 3(e), print the list of mentors and their mentee. Print only the names. See Figure 2 for the expected output. (3 marks) Student name Abbreviations: n: name 1: level email p.phone x: expertise m: mentee Studentin) getName() setName(n) displayinfo Mentee Mentor expertise level Menteen, e, p. displayinfo Mentorin, x) displayinfo) assignmentee(m) getMenteel) Contact email phone Contacte.p) displayinfo getEmail) setEmail(e) getPhone setPhone(p) Figure 1: Class diagram Table 3: Description of the members of each class. Description Class Members class Student name Student getName() and setName() Student's name. A constructor. Accessor and mutator methods. displayInfo() class Mentee level displays the student's information The class attribute indicating the level of progress for each mentee. There are five levels, from 1 to 5, where level 5 indicates mastery level. Mentee () A constructor. displayInfo() displays the mentee's information including name, email, phone and level, class Mentor expertise The mentor's area of expertise that he or she can be coaching, e.g., "C++ Programming", "Game Programming, etc. Mentor() displayInfo() assignmentee () A constructor displays the mentor's information. assigns a mentee to the mentor. returns the mentee's name of the mentor. However, if the mentor has not been assigned to any mentee, this method will return an empty string. getMentee () classs attributes A constructor class Contact email, phone Contact () getEmail(), setEmail(), get Phone () and setPhone() Accessor and mutator methods. displayInfo() displays the contact information The list of students Student #1 Mentee's Name : Abdul Samad Mentee's Email : asamad892@gmail.com Mentee's Phone : 013-89001000 Mentee's Level : 2 Student 2 This student is a mentor Name : Ahmad Kamal Expertise : Web Programming Information about the mentee under him/her: Mentee's Name Abdul Samad Mentee's Email : asamad892@gmail.com Mentee's Phone : 013-89001000 Mentee's Level : 2 Output of question 3(g) Student +3 Mentee's Name : Siti Nurdiana Mentee's Email : ct.nur@yahoo.com Mentee's Phone : 011-123013456 Mentee's Level : 1 Student #4 This student is a mentor Name : Siti Aminah Expertise : Java and C++ ** No mentee yet ** Mentor Mentee Ahmad Kamal Siti Aminah Abdul Samad Siti Nurdiana Output of question 30) Figure 2: Program output Question [100 Marks) A school wants to store information about its students joining a mentoring programme that the school currently runs. The students are divided into two groups, mentors and mentees. Mentors are more knowledgeable students and offer helps to mentees. Mentors are chosen from those students with good CPAs. They can mentor only one mentee maximum. Mentee's progress are kept track based on their levels, i.e., from level 1 to 5 where 5 indicates a mastery level. Besides, mentee's contact information will also be stored. Given a class diagaram that models the above problem in Figure 1 and the details about it the class diagram in Table 3. Answer the questions 1 to 3 below. Note: As for questions 1 and 2, write your answers on papers, and for question 3, write your program using any C++ IDE such as DevCpp. Use the codebase program provided, main.cpp. 1. Determine whether the following classes form any relationship to each other in the context of Object-Oriented Programming (OOP). If so, name the type of relationship, otherwise write No Relationship. a. Student and Mentor b. Mentor and Mentee c. Contact and Mentor d. Mentee and Contact e. Contact and Student f Mentee and Student (12 marks) 2. The problem given above involves several OOP concepts including inheritance and polymorphism. a. Explain TWO (2) main roles of the inheritance concept in the above problem. Indicate in which part of the class diagram these roles take place. (16 marks) b. Explain how the concept of polymorphism plays the role in the above problem. (10 marks) c. Identify TWO (2) methods that will be specified as polymorphic. Justify your answer. Finaly, explain how you are going to make these methods polymorphic. (12 marks) 3. Implement the class diagram in Ch. Separate the class definition from the class declaration within the same file. Accomplish the following tasks in your program. Write your code in the provided codebase program. Note that, some of the code has been given in the codebase program. a. Complete the declaration of all classes. (12 marks) b. Define all the methods of the class Student. ( 6 marks) c. Define all the methods of the class Mentee. (5 marks) d. Define all the methods of the class Mentor. (13 marks) e. In the main function, declare two arrays below: an array of mentees an array of mentors and initialize the arrays with the sample data given in Table 1 and Table 2. (5 marks) Table 1: Sample data for mentee students No Mentee's name Email Phone 1 Abdul Samad asamad892@gmail.com 013-89001000 2 Siti Nurdiana ct. nur@yahoo.com 011-123013456 Level 2 2 2 Table 2: Sample data for mentor students No Mentor's name Expertise 1 Ahmad Kamal Web Programming Siti Aminah Java and C++ 2 f. Declare another array to hold a list of students and fill in the array with all the mentees and mentors created in 3(e). (3 marks) g. Using a loop, print the list created in 3(t). The output should look like as in Figure 2. (2 marks) h. Using the array created in 3(e), assign the second mentee to the second mentor. (1 mark) 1. Using a loop and the array created in 3(e), print the list of mentors and their mentee. Print only the names. See Figure 2 for the expected output. (3 marks) Student name Abbreviations: n: name 1: level email p.phone x: expertise m: mentee Studentin) getName() setName(n) displayinfo Mentee Mentor expertise level Menteen, e, p. displayinfo Mentorin, x) displayinfo) assignmentee(m) getMenteel) Contact email phone Contacte.p) displayinfo getEmail) setEmail(e) getPhone setPhone(p) Figure 1: Class diagram Table 3: Description of the members of each class. Description Class Members class Student name Student getName() and setName() Student's name. A constructor. Accessor and mutator methods. displayInfo() class Mentee level displays the student's information The class attribute indicating the level of progress for each mentee. There are five levels, from 1 to 5, where level 5 indicates mastery level. Mentee () A constructor. displayInfo() displays the mentee's information including name, email, phone and level, class Mentor expertise The mentor's area of expertise that he or she can be coaching, e.g., "C++ Programming", "Game Programming, etc. Mentor() displayInfo() assignmentee () A constructor displays the mentor's information. assigns a mentee to the mentor. returns the mentee's name of the mentor. However, if the mentor has not been assigned to any mentee, this method will return an empty string. getMentee () classs attributes A constructor class Contact email, phone Contact () getEmail(), setEmail(), get Phone () and setPhone() Accessor and mutator methods. displayInfo() displays the contact information The list of students Student #1 Mentee's Name : Abdul Samad Mentee's Email : asamad892@gmail.com Mentee's Phone : 013-89001000 Mentee's Level : 2 Student 2 This student is a mentor Name : Ahmad Kamal Expertise : Web Programming Information about the mentee under him/her: Mentee's Name Abdul Samad Mentee's Email : asamad892@gmail.com Mentee's Phone : 013-89001000 Mentee's Level : 2 Output of question 3(g) Student +3 Mentee's Name : Siti Nurdiana Mentee's Email : ct.nur@yahoo.com Mentee's Phone : 011-123013456 Mentee's Level : 1 Student #4 This student is a mentor Name : Siti Aminah Expertise : Java and C++ ** No mentee yet ** Mentor Mentee Ahmad Kamal Siti Aminah Abdul Samad Siti Nurdiana Output of question 30) Figure 2: Program output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started