Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in c++ Objectives Understand and practice Inheritance o Polymorphism Virtual vs. non-virtual functions o Abstract classes General Notes (Important): 1. In this assignment, you are

in c++

image text in transcribed

image text in transcribed

image text in transcribed

Objectives Understand and practice Inheritance o Polymorphism Virtual vs. non-virtual functions o Abstract classes General Notes (Important): 1. In this assignment, you are given part of the implementation as a help 1.1. Feel free to use it 1.2. It is not complete. You will need to address any requirements that are not implemented 2. This is an individual assignment. 2.1. You are not allowed to work in groups 2.2. make sure you do not share you code with any other student 2.3. It does not matter if you give your code to other students or they get it without your permission! In both cases that would be considered as cheating. 2.4. Cheating is strictly prohibited and will cost you severely, possibly the whole course or even the semester 3. You should submit your work via e-learning as one zip/tar file that has 3.1. header files *.h: for class interface (one for each class) 3.2. source files *.cpp : for class implementation (one for each class) 3.3. main.cpp: main program (only one) 3.4. guard your header files against multiple inclusions 4. The member functions that do not modify data members should be declared and defined as const 5. Write any type of constructors, setters, or getters your program might need. You are asked to implement a class hierarchy for students in a university. There are two categories of students, Bachelor and Master. You need to implement o base class Student and two derived classes, one for the Bachelor students and another for the Master students. Assume that each student in the university has a studenti, a name, a gpa, and a major. Bachelor students are required to do o graduation project and training at some company. Master students are required to do a thesis. Bachelor student rating is different from Master student rating. Question 1 (20 Marks): Implement the following Student class such that: 1. the default constructor will initialize the student ID to 0, name to "NA", gpa to 0, and major to "NA". 2. the parameterized constructor will use the received arguments to initialize the class data members. 3. implement the setters appropriately 4. implement getMajor() function to return the major of a student 5. make the member functions GetRating() and IsBachelor() as pure virtual functions 6. implement the printStudent() function to print all the attributes in the Student class. class Student public: Student (); Student (int i, float g, string n, string m); LU) Tunction to print all the attributes in the Student class Student { public: Student (); Student (int i, float g, string n, string m) ; void SetID(int id) ; void SetGPA (float gpa) ; void SetName(string name) ; void SetMajor (string major); string GetMajor(); string getRating (); bool IsBachelor(); virtual void printStudent(); protected: float GetGPA (); private: int Student ID; string name ; string major; float gpa

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

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago