Question
Write a C++ program followig the below Create a parent class called CompSciProfessor. Each professor has name (type string), email (type string), and facultyId (type
Write a C++ program followig the below
Create a parent class called CompSciProfessor. Each professor has name (type string), email (type string), and facultyId (type long). Specialize the CompSciProfessor class into two more classes: AdjunctProf, and TenureTrackProf classes.
The specialized class AdjunctProf has three attributes of its own: degree (type char), NoOfTA (type int), and NoOfCourses (type int). The attribute degree refers to the degree of the adjunct professor. You assign B to represent bachelor degree, M for Master degree, and P for PhD. NoOfTA refers to the number of TAs the adjunct professor is doing for the courses. For example, if NoOfTA=2, it means the adjunct professor is doing TA for two courses. NoOfCourses refers to the number of courses that the adjunct professor is currently teaching in the department.
The specialized class TenureTrackProf has two attributes of its own: rank (type char), and YearOfExp (type int). The attribute rank refers to the rank of the tenure track professor. You assign A to represent Assistant Professor, S for Associate Professor, and F for Full Professor. YearOfExp is used to keep track of the number of years the professor has been teaching in the computer science department.
Do the following:
Create the base class CompSciProfessor
Create the derived classes AdjunctProf and TenureTrackProf
Create set and get functions for all attributes of CompSciProfessor class
For AdjunctProf class:
Create set and get function associated with the specialized attributes
Create a method void print() const that prints both the specialized attributes and inherited attributes
Create a method called float findSalary( ) const that calculates the salary of the adjunct professor
For TenureTrackProf class:
Create set and get function associated with the specialized attributes
Create a method void print() const that prints both the specialized attributes and inherited attributes
Create a method called float findSalary( ) const that calculates the salary of the adjunct professor
Implement the default constructor (initialize the attributes to some arbitrary numbers) for all classes
Do the following in the main program:
Create an object of Adjunct professor
Set the name to Adam Smith, facultyId to12345, email to asmith@csusm.edu, degree to Master degree. Adam Smith is teaching 1 course and is doing teaching assistant (TA) for two courses.
Call the findSalary() method to find the salary of Adam Smith
Print Adam Smiths information (properties) on the screen
Further:
Create an object of Tenure Track Professor:
Set the name to Jim Anderson, FacultyId to 54321, email to janderson@csusm.edu, rank to Associate Professor. Jim Anderson is working for 8 years in the department of computer science.
Call the findSalary() method to find the salary of Jim Anderson
Print Jim Andersons information (properties) on the screen
The salary of an adjunct professor is calculated as follows:
Salary = The amount of money earned from doing TA + The amount of money earned from teaching courses
Degree | Salary for one TA | Salary for teaching one course |
Bachelor | $1500 | $3000 |
Master | $2000 | $4000 |
PhD | $2500 | $5000 |
For example, if an adjunct professor has a master degree and doing 2 TA and teaching 3 courses, he/she earns (2*$2000)+(3*$4000) = $16000
The salary of a tenure track professor is calculated as follows:
Salary = The base salary based on the rank + ($1500 *Year Of Experience)
Rank | Base Salary |
Assistant | $65,000 |
Associate | $80,000 |
Full | $90,000 |
For example, a full professor with 10 years of experience earns ($90000+($1500*10) = $105,000)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started