please use c++ oop
and copy and past the code when u finish
please follow this code
#include #include using namespace std;
//------------------------------------------------------------------------------------------------------------- // Class declarations >> Student, Mentor, Coach, Support and Mentee //------------------------------------------------------------------------------------------------------------- // Class Student is fully given. Do nothing on this class.
class Student { protected: string name;
public: Student(string n = ""); string getName() const; void setName(string n); };
// Task 1(a): Declare the class Mentor. class Mentor { protected: double cpa;
public: Mentor(string n, double c); };
// Task 1(b): Declare the class Coach. class Coach { protected: public: Coach(string name, double cpa, string expertise); };
// Task 1(c): Declare the class Support. class Support { protected: public: Support(string name, double cpa, string phone); };
// Task 1(d): Declare the class Mentee. class Mentee { protected: public: Mentee(string name, int level); };
//------------------------------------------------------------------------------------------------------------- // Class definition >> Student //------------------------------------------------------------------------------------------------------------- // Class Student is given. Do nothing on this class.
Student::Student(string n) : name(n) {} string Student::getName() const { return name; } void Student::setName(string n) { name = n; }
//------------------------------------------------------------------------------------------------------------- // Class definition >> Mentor //------------------------------------------------------------------------------------------------------------- // Task 2: Define all methods for the class Mentor.
//------------------------------------------------------------------------------------------------------------- // Class definition >> Coach //------------------------------------------------------------------------------------------------------------- // Task 3: Define all methods for the class Coach. Coach::Coach(string name, double cpa, string expertise) {} //------------------------------------------------------------------------------------------------------------- // Class definition >> Support //------------------------------------------------------------------------------------------------------------- // Task 4: Define all methods for class Support. Support::Support(string name, double cpa, string phone) {}
//------------------------------------------------------------------------------------------------------------- // Class definition >> Mentee //------------------------------------------------------------------------------------------------------------- // Task 5: Define all methods for the class Mentee. Mentee::Mentee(string name, int level) {}
//------------------------------------------------------------------------------------------------------------- // The menu function is given int menu() { cout
int choice; cout "; cin >> choice;
cin.ignore(); cout
return choice; }
//------------------------------------------------------------------------------------------------------------- // The Main Function //-------------------------------------------------------------------------------------------------------------
int main() { // Given an array of mentees. Mentee mentees[3] = {Mentee("Abdul Samad", 2), Mentee("Nurdiana", 1), Mentee("Nurazlan", 2)}; int index; // the index of mentee that the user wants to work on. To be used in case 5 and case 6
// Given two mentors Coach mentor1("Ahmad Kamal", 3.87, "Programming"); Support mentor2("Siti Aminah", 3.98, "0123456789");
// Task 6(a): Declare a pointer to be used for pointing to a coach-mentor or a support-mentor. // Initialize this pointer to point to any of the mentors (mentor1 or mentor2). int operation; // menu operation chosen by the user
operation = menu();
while (operation != 9) { switch (operation) { case 1: // Task 6(b): Select the first mentor (mentor1), as the current mentor. cout
case 2: // Task 6(c): Select the second mentor (mentor2), as the current mentor. cout
case 3: // Task 6(d): Display the name of the selected mentor. cout
case 4: // Task 6(e): Edit the selected mentor. break;
case 5: // Task 6(f): Assign the selected mentor to a mentee. cout "; cin >> index; break;
case 6: // Task 6(g): Unassign the mentor from a mentee. cout "; cin >> index; break;
case 7: // Task 6(h): Display the info for each of the mentees. cout
} // switch
operation = menu();
} // while
system("pause"); // You may want to comment out this line (system("pause")) if you are using Dev C++ return 0; }
School of Computing is planning to implement a mentoring programme involving all the students in the school. The programme will be run as follows: The students are divided into two categories, mentor and mentee. A mentor is a more knowledgeable student and offers helps to a mentee, a less knowledgeable student. Mentors are chosen from those students with good CPAs. Mentee's progress are kept track based on their levels, from level 1 to 5. There are two approaches of mentoring: -Coaching-based mentors will coach their mentees in particular areas, e.g., "CH+ programming". "Game Programming", etc. Therefore, a coach must be expert in that area. -Support-based: mentors offer their supports to the mentees without having to meet face to face. Thus, the mentors need to provide their phone numbers. Abbreviations: Student name Student (n) getName() setName(n) n: name 1: level mentor e: expertise P: phone Mentee level Mentee (n.) assignMentor (m) displayInfo() Mentor Mentor (n.) edit() print() Coach expertise Coach (nice) getExpertise setExpertise (e) edit() print() Support phone Support (n.cp) getPhone () setPhone (p) edit() print) Figure 1: Class diagram for Mentoring System The school has hired you to develop a computer program to manage the records of the mentors and mentees. The class diagram for the program has been done by a senior software engineer and it is given in Figure 1 above. The classes are described further in Table I below. Table 1: Description of the members of each class Description Class Members class Student name Student (...) getName() and setName (...) class Mentee level Student's name . A constructor. Accessor and mutator to the attribute. 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. assignMentor (...) displayInfo() To assign a mentor to mentee. To display the mentee's information including: name and level, his/her mentor's details depending the type of the mentor, i.e. either a coach mentor or a support mentor. If no mentor is assigned yet, then this method will print a message indicating that class Mentor Mentor (...) edit() Mentor's cpa. A constructor To edit mentor information by the user. print() To print the mentor's name and cpa. class Coach expertise The mentor's area of expertise that he or she can be coaching, e.g., C++ Programming", "Game Programming". etc. Coach (...) A constructor. getExpertise () and Accessor and mutator to the attribute. set Expertise (...) edit() To edit mentor's expertise by the user. print) To print the mentor's name, cpa and expertise. class Support phone Support (...) get Phone () and setPhone (...) The mentor's phone number. A constructor. Accessor and mutator to the attribute. edit) To edit mentor's phone number by the user. To print the mentor's name, cpa and phone. print() Based on the class diagram in Figure 1 and specifications in Table 1, answer the questions (a) to (c) below: Note: As for questions 1 and 2, write your answers in a separate text file. Indicate the question numbers in your answers. 1. Determine the type of relationship formed between the following classes: a Mentee and Student b. Mentee and Mentor c. Coach and Mentor d. Coach and Student c. Coach and Mentee (10 marks) 2. Analyse the class diagram in Figure 1 and its description in Table 1 as well as the program's output in Figure 2. Name TWO (2) methods that later in the the code, will be declared as virtual. Justify your answers. (10 marks) 3. Finally, implement the class diagram by modifying code in exercise3.cpp. Complete the following tasks in the program. Your code must follow the class diagram. a. Task 1. Delcare all the classes based on the class diagram. (10 marks) b. Task 2: Define all methods for the class Mentor (10 marks) c. Task 3: Define all methods for the class Coach (15 marks) d. Task 4: Define all methods for the class Support (15 marks) e. Task 5: Define all methods for the class Mentee (10 marks) f. Task 6: In the main function, an array of mentees and two mentors have been created. Complete the remaining tasks. See Task 6(a) to (h) in the program. (20 marks) Output: The program should produce the output as shown in Figure 2. Note that, bold texts indicate user inputs. Screen 1: Displaying the current mentor. Menu 1. Select first mentor 2. Select second mentor 3. Display selected mentor 4. Edit selected mentor 5. Assign selected mentor to mentee 6. Unassign mentor from mentee 7. Display all mentees 9. Exit Choose an operation [1-7, or 9] => 3 Current selected mentor: Ahmad Kamal mentorl is the current mentor Sereen 2: Assigning the current mentor to the first and second mentees (i.e index 0 and 1). == Menu 1. Select first mentor 2. Select second mentor 3. Display selected mentor 4. Edit selected mentor 5. Assign selected mentor to mentee 6. Unassign mentor from mentee 7. Display all mentees 9. Exit Choose an operation (1-7, or 9) => 5 Enter the index of mentee to assign with the current mentor => 0
5 Enter the index of mentee to assign with the current mentor => 1 Screen 3: Displaying the mentee list. Choose an operation [1-7, or 9] => 7 List of mentees: #1 Mentee's Name : Abdul Samad Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Programming #2 Mentee's Name : Nurdiana Mentee's Level : 1 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Programming #3 Mentee's Name Nurazlan Mentee's Level : 2 The last mentee has yet to be ** No mentor yet ** assigned with a mentor Screen 4: Changing the current mentor to another and assigning it to the last mentee (index 2). } Menu 1. Select first mentor 2. Select second mentor 3. Display selected mentor 4. Edit selected mentor 5. Assign selected mentor to mentee 6. Unassign mentor from mentee 7. Display all mentees 9. Exit Choose an operation (1-7, or 9] => 2 Second mentor is selected Choose an operation [1-7, or 9] => 5 Enter the index of mentee to assign with the current mentor -> 2 choose an operation (1-7, or 9] => 7 List of mentees: #1 Mentee's Name : Abdul Samad Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Programming #2 Mentee's Name : Nurdiana Mentee's Level : 1 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Programming #3 Mentee's Name : Nurazlan Mentee's Level : 2 Mentoring type : Support-based Mentor's Name : Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : 0123456789 The last mentee now has a mentor Screen 5: Changing the expertise info of the first mentor (i.e., mentori) and the phone number for the second mentor (.e. mentor2). Menu 1. Select first mentor 2. Select second mentor 3. Display selected mentor 4. Edit selected mentor 5. Assign selected mentor to mentee 6. Unassign mentor from mentee 7. Display all mentees 9. Exit Choose an operation (1-7, or 9] => 1 First mentor is selected Choose an operation [1-7, or 9] => 4 Mentor's Information: Mentoring type : Coach-based Mentor's Name Ahmad Kamal Mentor's CPA : 3.87 Current mentor is mentorl (a Mentor's Expertise : Programming coach mentor). Thus, editing will be on coach data. You can only edit the mentor's expertise Enter new expertise -> Mobile and Web Programming Choose an operation [1-7, or 9] => 2 Second mentor is selected Choose an operation [1-7, or 9] => 4 Mentor's Information: Men ring type : Support-based Mentor's Name Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : 0123456789 Current mentor is changed to mentor2 (a support-mentor). Thus, editing will be on support- mentor data You can only edit the mentor's phone number Enter new phone number => +6013-89001000 Choose an operation (1-7, or 9] => 7 List of mentees: #1 Mentee's Name : Abdul Samad Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Mobile and Web Programming Here, the mentor's expertise has changed accordingly. #2 Mentee's Name Nurdiana Mentee's Level : 1 Mentoring type Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Mobile and Web Programming } Here, the mentor's expertise has changed accordingly. #3 Mentee's Name : Nurazlan Mentee's Level : 2 Mentoring type : Support-based Mentor's Name : Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : +6013-89001000 Here, the mentor's phone number has Sereen 6: Removing the mentor from the second mentee (i.e., at index 1). Choose an operation (1-7, or 9] => 6 Enter the index of mentee to remove its mentor => 1 Choose an operation (1-7, or 9] => 7 List of mentees: #1 Mentee's Name : Abdul Samad Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Mobile and Web Programming #2 Mentee's Name : Nurdiana Mentee's Level : 1 ** No mentor yet ** This mentee now does not have a mentor. #3 Mentee's Name : Nurazlan Mentee's Level : 2 Mentoring type : Support-based Mentor's Name : Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : +6013-89001000 Figure 2: Program output School of Computing is planning to implement a mentoring programme involving all the students in the school. The programme will be run as follows: The students are divided into two categories, mentor and mentee. A mentor is a more knowledgeable student and offers helps to a mentee, a less knowledgeable student. Mentors are chosen from those students with good CPAs. Mentee's progress are kept track based on their levels, from level 1 to 5. There are two approaches of mentoring: -Coaching-based mentors will coach their mentees in particular areas, e.g., "CH+ programming". "Game Programming", etc. Therefore, a coach must be expert in that area. -Support-based: mentors offer their supports to the mentees without having to meet face to face. Thus, the mentors need to provide their phone numbers. Abbreviations: Student name Student (n) getName() setName(n) n: name 1: level mentor e: expertise P: phone Mentee level Mentee (n.) assignMentor (m) displayInfo() Mentor Mentor (n.) edit() print() Coach expertise Coach (nice) getExpertise setExpertise (e) edit() print() Support phone Support (n.cp) getPhone () setPhone (p) edit() print) Figure 1: Class diagram for Mentoring System The school has hired you to develop a computer program to manage the records of the mentors and mentees. The class diagram for the program has been done by a senior software engineer and it is given in Figure 1 above. The classes are described further in Table I below. Table 1: Description of the members of each class Description Class Members class Student name Student (...) getName() and setName (...) class Mentee level Student's name . A constructor. Accessor and mutator to the attribute. 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. assignMentor (...) displayInfo() To assign a mentor to mentee. To display the mentee's information including: name and level, his/her mentor's details depending the type of the mentor, i.e. either a coach mentor or a support mentor. If no mentor is assigned yet, then this method will print a message indicating that class Mentor Mentor (...) edit() Mentor's cpa. A constructor To edit mentor information by the user. print() To print the mentor's name and cpa. class Coach expertise The mentor's area of expertise that he or she can be coaching, e.g., C++ Programming", "Game Programming". etc. Coach (...) A constructor. getExpertise () and Accessor and mutator to the attribute. set Expertise (...) edit() To edit mentor's expertise by the user. print) To print the mentor's name, cpa and expertise. class Support phone Support (...) get Phone () and setPhone (...) The mentor's phone number. A constructor. Accessor and mutator to the attribute. edit) To edit mentor's phone number by the user. To print the mentor's name, cpa and phone. print() Based on the class diagram in Figure 1 and specifications in Table 1, answer the questions (a) to (c) below: Note: As for questions 1 and 2, write your answers in a separate text file. Indicate the question numbers in your answers. 1. Determine the type of relationship formed between the following classes: a Mentee and Student b. Mentee and Mentor c. Coach and Mentor d. Coach and Student c. Coach and Mentee (10 marks) 2. Analyse the class diagram in Figure 1 and its description in Table 1 as well as the program's output in Figure 2. Name TWO (2) methods that later in the the code, will be declared as virtual. Justify your answers. (10 marks) 3. Finally, implement the class diagram by modifying code in exercise3.cpp. Complete the following tasks in the program. Your code must follow the class diagram. a. Task 1. Delcare all the classes based on the class diagram. (10 marks) b. Task 2: Define all methods for the class Mentor (10 marks) c. Task 3: Define all methods for the class Coach (15 marks) d. Task 4: Define all methods for the class Support (15 marks) e. Task 5: Define all methods for the class Mentee (10 marks) f. Task 6: In the main function, an array of mentees and two mentors have been created. Complete the remaining tasks. See Task 6(a) to (h) in the program. (20 marks) Output: The program should produce the output as shown in Figure 2. Note that, bold texts indicate user inputs. Screen 1: Displaying the current mentor. Menu 1. Select first mentor 2. Select second mentor 3. Display selected mentor 4. Edit selected mentor 5. Assign selected mentor to mentee 6. Unassign mentor from mentee 7. Display all mentees 9. Exit Choose an operation [1-7, or 9] => 3 Current selected mentor: Ahmad Kamal mentorl is the current mentor Sereen 2: Assigning the current mentor to the first and second mentees (i.e index 0 and 1). == Menu 1. Select first mentor 2. Select second mentor 3. Display selected mentor 4. Edit selected mentor 5. Assign selected mentor to mentee 6. Unassign mentor from mentee 7. Display all mentees 9. Exit Choose an operation (1-7, or 9) => 5 Enter the index of mentee to assign with the current mentor => 0 5 Enter the index of mentee to assign with the current mentor => 1 Screen 3: Displaying the mentee list. Choose an operation [1-7, or 9] => 7 List of mentees: #1 Mentee's Name : Abdul Samad Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Programming #2 Mentee's Name : Nurdiana Mentee's Level : 1 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Programming #3 Mentee's Name Nurazlan Mentee's Level : 2 The last mentee has yet to be ** No mentor yet ** assigned with a mentor Screen 4: Changing the current mentor to another and assigning it to the last mentee (index 2). } Menu 1. Select first mentor 2. Select second mentor 3. Display selected mentor 4. Edit selected mentor 5. Assign selected mentor to mentee 6. Unassign mentor from mentee 7. Display all mentees 9. Exit Choose an operation (1-7, or 9] => 2 Second mentor is selected Choose an operation [1-7, or 9] => 5 Enter the index of mentee to assign with the current mentor -> 2 choose an operation (1-7, or 9] => 7 List of mentees: #1 Mentee's Name : Abdul Samad Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Programming #2 Mentee's Name : Nurdiana Mentee's Level : 1 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Programming #3 Mentee's Name : Nurazlan Mentee's Level : 2 Mentoring type : Support-based Mentor's Name : Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : 0123456789 The last mentee now has a mentor Screen 5: Changing the expertise info of the first mentor (i.e., mentori) and the phone number for the second mentor (.e. mentor2). Menu 1. Select first mentor 2. Select second mentor 3. Display selected mentor 4. Edit selected mentor 5. Assign selected mentor to mentee 6. Unassign mentor from mentee 7. Display all mentees 9. Exit Choose an operation (1-7, or 9] => 1 First mentor is selected Choose an operation [1-7, or 9] => 4 Mentor's Information: Mentoring type : Coach-based Mentor's Name Ahmad Kamal Mentor's CPA : 3.87 Current mentor is mentorl (a Mentor's Expertise : Programming coach mentor). Thus, editing will be on coach data. You can only edit the mentor's expertise Enter new expertise -> Mobile and Web Programming Choose an operation [1-7, or 9] => 2 Second mentor is selected Choose an operation [1-7, or 9] => 4 Mentor's Information: Men ring type : Support-based Mentor's Name Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : 0123456789 Current mentor is changed to mentor2 (a support-mentor). Thus, editing will be on support- mentor data You can only edit the mentor's phone number Enter new phone number => +6013-89001000 Choose an operation (1-7, or 9] => 7 List of mentees: #1 Mentee's Name : Abdul Samad Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Mobile and Web Programming Here, the mentor's expertise has changed accordingly. #2 Mentee's Name Nurdiana Mentee's Level : 1 Mentoring type Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Mobile and Web Programming } Here, the mentor's expertise has changed accordingly. #3 Mentee's Name : Nurazlan Mentee's Level : 2 Mentoring type : Support-based Mentor's Name : Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : +6013-89001000 Here, the mentor's phone number has Sereen 6: Removing the mentor from the second mentee (i.e., at index 1). Choose an operation (1-7, or 9] => 6 Enter the index of mentee to remove its mentor => 1 Choose an operation (1-7, or 9] => 7 List of mentees: #1 Mentee's Name : Abdul Samad Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Mobile and Web Programming #2 Mentee's Name : Nurdiana Mentee's Level : 1 ** No mentor yet ** This mentee now does not have a mentor. #3 Mentee's Name : Nurazlan Mentee's Level : 2 Mentoring type : Support-based Mentor's Name : Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : +6013-89001000 Figure 2: Program output