Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ QUESTIONS PLEASE ANSWER THIS ASAP HELP IS VERY MUCH NEEDED THANK YOUU THIS IS THE CODE GIVEN : #include #include using namespace std; //

C++ QUESTIONS PLEASE ANSWER THIS ASAP

HELP IS VERY MUCH NEEDED THANK YOUU

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

image text in transcribed

THIS IS THE CODE GIVEN :

#include #include using namespace std;

// The declaration for class 'Student' is fully given. Do nothing to it. // As for other classes, the declaration are partially given. Complete the rest.

class Student{ string name; public: Student(string n = ""); string getName() const; void setName(string n); void print() const; };

class Mentor{ public: Mentor(string n, double c); };

class Coach{ public: Coach(string n, double c, string e); };

class Support{ public: Support(string n, double c, string p); };

class Mentee{ public: Mentee(string n, int l); };

//-------------------------------------------------------------------------------------------------------------

// Definition for the class 'Student' is fully given. Do nothing to it.

Student::Student(string n) : name(n) {} string Student::getName() const { return name; } void Student::setName(string n) { name = n; } void Student::print() const { cout

int main() { // system("pause"); // uncomment this line if you are using VS Code return 0; } //

Question [100 Marks) A school is currently running a mentoring programme for its students. The students are divided into two groups, mentors and mentees. Mentors are more knowledgeable students and offer helps to mentees. They are chosen from those students with good CPAs. The programme offers two types of mentoring: Coaching-based mentoring: mentors will coach their mentees in particular areas, e.g., C++ programming, Game Programming", etc. Therefore, a mentor must be expert in that area. Support-based mentoring: mentors offer their supports to the mentees without having to meet face to face. Thus, the mentor need to provide their phone numbers. Further, each mentee is assigned with only one mentor. Mentee's progress are kept track based on their levels, i.e. from level 1 to 5 where 5 indicates a mastery level. Given a class diagram that models the above problem in Figure 1 and the details about the class diagram in Table 2. 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 CH+ 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. Coach and Support b. Mentee and Student c. Mentee and Mentor d. Coach and Mentor e. Coach and Student f. Coach and Mentee 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 its 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 C++. 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 (12 marks) ( 2 marks) (5 marks) (5 marks) (14 marks) a. Complete the declaration of all classes. b. Define all the methods of the class Mentor. c. Define all the methods of the class Coach. d. Define all the methods of the class Support. e. Define all the methods of the class Mentee. f. In the main function, create several objects as follows: a coach-based mentor, a support-based mentor, an array of mentees. Set the objects with the sample data given in Table 1. (6 marks) Table 1: Sample data Mentee's name Mentoring Type Abdul Samad Coach-based Siti Nurdiana Jazlan Kamal Mentee's Mentor Level 2 Ahmad Kamal CPA: 3.87 Expertise: Web Programming 1 -Not assigned yet- 1 Siti Aminah CPA: 3.98 Phone : 013-89001000 2 Ahmad Kamal CPA: 3.87 Expertise: Web Programming Support-based Omar Abdullah Coach-based g. Using a loop, print the list of mentees you created in 3(f). The output should look like as in Figure 2. (2 marks) h. Remove or unassign the mentor from the last mentee. (1 mark) i. Using a loop, print the updated list of mentees and their mentors. Print only the names. See Figure 2 for the expected output. (3 marks) Abbreviations: Student name m: name level mentor expertise phone P: Student(n) getName() setName() printo Mentee Mentor level Mentorin, c) printo Mentee(n,1) assignMentor(m) removeMentor getMentorName print() Coach Support expertise phone Coach(n. c. e) print() Supportin, C, D) print) Figure 1: Class diagram Initial list of students along with their mentor #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 : Web Programming #2 Mentee's Name : Siti Nurdiana Mentee's Level : 1 ** No mentor yet ** Output of question 3(g) #3 Mentee's Name : Jazlan Kamal Mentee's Level : 1 Mentoring type : Support-based Mentor's Name : Siti Aminah Mentor's CPA : 3.98 Mentor's Phone : 013-89001000 Mentee's Name : Omar Abdullah Mentee's Level : 2 Mentoring type : Coach-based Mentor's Name : Ahmad Kamal Mentor's CPA : 3.87 Mentor's Expertise : Web Programming Updated list Mentee Mentor Ahmad Kamal Output of question 3 (i) Abdul Samad Siti Nurdiana Jazlan Kamal Omar Abdullah Siti Aminah Figure 2: Program output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

List all physical disk partitions and mount points.

Answered: 1 week ago

Question

10-3 How has e-commerce transformed marketing?

Answered: 1 week ago