Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Note: In the next three questions you will create a set of classes that are related by inheritance. It is recommended that you read all

image text in transcribed

Note: In the next three questions you will create a set of classes that are related by inheritance. It is recommended that you read all three questions before writing any code. Sketching out a class diagram as you read the questions will help you to get a picture of the required structure of the classes (you do not need to submit this diagram). Q3. Write an abstract class to represent a Student A student has an ID, a first name and a last name. The ID should be an integer and the first and last names should be C++strings. The class must have the following methods A constructor that takes a student ID value, a first name and a last name A int getiD) method which returns the student's ID value A pure virtual method string getType) which, if implemented in any class derived from Student, would be expected to return the type of student as a string A virtual void printinfo() method which prints out the student's details. This method should call the getType() method to print out the student type as the first line of the printout. 10 marks Q4. Write a concrete class called Research Student which inherits from your Student class of question 3. A research student has a supervisor name (as a single C++ string) and a thesis titile (as a C++ string). The class must also have the following methods: A constructor taking the student's ID, first and last names, supervisor name and thesis title. This constructor calls the parent class constructor. A void printinfoo method that calls the parent class's printinfoo method to print generic student information and also prints details specific to a research student. . A method that provides an implementation (overrides) the base class pure virtual function get Type) This method should simply return the string "Research Student". [10 marks Q5. Write a concrete class called TaughtStudent which also inherits from your Student class. A taught student has an array of module names for which they are registered. This array can have up to 10 module names. A module name is a C++ string. Additionally, the class has a member numRegisteredModules which stores the number of modules for which the student is currently registered. The class must have the tollwing methos .A constructor taking the student's ID, first and last name. The constructor should set numRegisteredModules to 0 . A method bool registerFor(const string& moduleName) which adds a module to the students modules. If the student is already registered for 10 modules then this method should return false, otherwise it returns true A void printinfo() method that calls the parent class printinfo0 method and also prints details specific to a taught student, including their list of registered modules. .An override for the base class pure virtual function that returns the string "Taught Student

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2010 Barcelona Spain September 2010 Proceedings Part 2 Lnai 6322

Authors: Jose L. Balcazar ,Francesco Bonchi ,Aristides Gionis ,Michele Sebag

2010th Edition

364215882X, 978-3642158827

More Books

Students also viewed these Databases questions

Question

What lessons in intervention design, does this case represent?

Answered: 1 week ago