Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include using namespace std; class Project{ private: string title; public: Project(string _title=){ setTitle(_title); } void setTitle(string _title) {title = _title;} string getTitle()const {return title;} };

image text in transcribed

#include using namespace std;

class Project{ private: string title; public: Project(string _title=""){ setTitle(_title); }

void setTitle(string _title) {title = _title;} string getTitle()const {return title;} }; // End of class Project

class Contact{ private: string phone; string email; public: Contact(string _phone="", string _email=""){ setPhone(_phone); setEmail(_email); }

void setPhone(string _phone) {phone = _phone;} void setEmail(string _email) {email = _email;} string getPhone() const {return phone;} string getEmail()const {return email;} }; // End of class Contact

class Person{ protected: string name; // Task 1: Add the attribute to implement the relationship between this class and // the class Contact public: // Task 2: Complete the constructor Person(string _name="", string _phone="", string _email=""){ }

void setName(string _name) {name = _name;} string getName() const {return name;} // Task 3: Complete the code for the methods setEmail and setPhone void setEmail(string _email) { } void setPhone(string _phone) { }

// Task 4: Complete the code for the methods getEmail and getPhone, respectively. string getPhone() const { } string getEmail() const { } }; // End of class Person

class Staff : public Person{ protected: string position; // e.g., Lecturer, Technician, Research Officer public: // Task 5: Complete the constructor Staff(string _name="", string _phone="", string _email="", string _position="") { }

void setPosition(string _position) {position = _position;} string getPosition() const {return position;} }; // End of class Staff

class Student : public Person{ protected: string program; // e.g., Computer Science, Electrical Engineering, etc.

// Task 6: Add the attributes to implement the relationship between this class and // the classes Project and Staff

public: // Task 7: Complete the constructor Student(string _name="", string _phone="", string _email="", string _program="", string _projectTitle="") { }

void setProgram(string _program) {program = _program;} string getProgram() const {return program;} // Task 8: Complete the code for the method setAdvisor void setAdvisor(Staff *_advisor) { } // Task 9: Complete the code for the method getProjectTitle string getProjectTitle() const { } // Task 10: Complete the code for the methods getAdvisorName and getAdvisorPosition, respectively string getAdvisorName() const {

}

string getAdvisorPosition() const {

} }; // End of class Student

int main() { Staff advisor1("Prof. Dr. Muhammad Roslan Abdullah", "019-9875678", "mroslana29mail.com","Lecturer"); Staff advisor2("Mr. Qamarool Zaman", "011-56781234", "qam23mail.com","Senior Technician"); Staff advisor3("Dr. Siti Zubaidah Rosli", "010-1117456", "ctzr983mail.com","Research Officer"); // Task 11: Create an array of students with the following information // // "Lim Sew Ying", "010-897634045", "lsying1212@live.utm.my","Electrical Engineering", "Smart Dustbin" // "Abu Bakar Razali", "011-1210000", "abraz78@live.utm.my","Computer Science", "Money Recognition for Blind People" // "Nur Amalina Muhammad", "012-9000123", "nama978@live.utm.my","Biomedical Engineering", "Dengue Testing Kit"

// Task 12: Print the information of all the students along with their project's title

cout

// Task 13: You should notice that in Task 12 there is no information about the advisors because they have not been set yet for each of the students // Thus, assign each student with an advisor. You may arrange the assignment on your own. // Task 14: Print again the information of all the students along with their project's title and advisor

cout

// Task 15: Suddenly, the first and second students want to change their advisor each other, while // the advisor for the third student wants to withdraw from being appointed as an advisor. // Write the code to implement these situations.

// Task 16: Print again the information of all the students

cout Problem School of Computing will be organizing a competition that is open to all UTM students. The competition is meant to provide a platform to the students to exhibit their idea. Some important notes regarding the competition: It is an individual participation. Each student must have a project beforehand. Each student has to find an advisor which can be any UTM staff regardless of their position. That means, besides lecturers technicians, research officers, etc, also can be appointed as advisers. However, only one advisor is allowed for each student. Also, a staff can only advice one student. Person name string Person) setNamel_name string) setid_id string) @getName(string getPhone() string @getEmail() string Contact phone string email string Contacto setPhone(_phone string) setEmaill_email: string) getPhone(): string getEmailly string Staff position: string Staffo) setPosition(_position string) advisor getPosition() string Student program string Studenti) setProgram_program string) setProject (_project. Project) setAdvisor(_advisor. Project) getProject Title) string getProgram() string @getProjectAreal). string getAdvisorName() string getAdvisorPosition() string Project title: string Project) setTitle_title: string) setAreal_area string) getTitle(): string getArea(): string Figure 1: UML class diagram You are hired by the School to develop a program that manages the records of the participants. Suppose the class design has been done by other parties as shown in Figure 1. You are also provided an incomplete program (week11.cpp). Complete the program based on the tasks stated in the program (Task 1 to Task 16). The program should produce output like shown in Figure 2

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

More Books

Students also viewed these Databases questions

Question

socialist egalitarianism which resulted in wage levelling;

Answered: 1 week ago

Question

soyuznye (all-Union, controlling enterprises directly from Moscow);

Answered: 1 week ago