Answered step by step
Verified Expert Solution
Question
1 Approved Answer
IN C++ this assignment consists of three exercises. three header file (.h) for two classes, four CPP source files (.cpp) for classes implementation and the
IN C++
this assignment consists of three exercises. three header file (.h) for two classes, four CPP source files (.cpp) for classes implementation and the main function. Also, in your header file, you must prevent multiple file inclusion. Your code should use separate implementation of the class.
Lab Exercises Person (-) name Type: string (-) address Type: string (-) birthYear Type: int (-) national No Type: int (+) Parameterized Constructor (+) Setters (+) Getters (+) printDetails : void Employee Student (-) salary Type: int (-) major Type: string (-) department Type: string (-) GPA Type: string (+) Parameterized Constructor (+) Parameterized Constructor (+) Getters (+) Getters (+) Setters (+) Setters NOTE 1: In all of your code, do not forget to validate all user input and to make all functions that do not modify the class constant. NOTE 2: Avoid duplication of code! If something is already done in the base class, do not do it again in the derived class. Exercise 1 - Define Person Class Exercise Obiectives Define class Problem Description Implement class Person. The parametrized constructor initializes the values of all data members. Function printDetails should print information about the person in a well-formatted manner. Exercise 2 - Define Employee Class Exercise Objectives Define class Problem Description Declare and implement Employee, which inherits from class Person. Note the following: The salary data member represents the salary of the employee in JOD. The department data member can be either IT" or "Finance". Function printDetails of the base class should be overridden to print the additional information about the salary and department. Exercise 3 - Define Student Class Exercise Objectives Define class Problem Description Declare and implement Student, which inherits from class Person. Note the following: The major data member can be Computer Science, Software Engineering, Accountant or Economy. Function getName in the base class should be overridden to return the name + "(Student). Function printDetails of the base class should be overridden to print the additional information about the major and grade. Exercise 5 - Implement a Friend Function Exercise Objectives Define Friend Function Problem Description Write a friend function (checkGPA) to the Student class to return True if the student GPA is more than or equals to 85. Otherwise, it returns False. Exercise 4 - Implement Main Write the main function as follows. Create an object of type Employee (EMP), assign the appropriate values for each data member. Create an object of type Student (STD), assign the appropriate values for each data member. Exercise 3 - Define Student Class Exercise Objectives Define class Problem Description Declare and implement Student, which inherits from class Person. Note the following: The major data member can be Computer Science, Software Engineering, Accountant or Economy. Function getName in the base class should be overridden to return the name + "(Student). Function printDetails of the base class should be overridden to print the additional information about the major and grade. Exercise 5 - Implement a Friend Function Exercise Objectives Define Friend Function Problem Description Write a friend function (checkGPA) to the Student class to return True if the student GPA is more than or equals to 85. Otherwise, it returns False. Exercise 4 - Implement Main Write the main function as follows. Create an object of type Employee (EMP), assign the appropriate values for each data member. Create an object of type Student (STD), assign the appropriate values for each data member. Print the details of both objects. The company owner wants to hire the STD in an appropriate department, you are asked to check the major and GPA of STD o If case STD's major is Computer Science or Software Engineering, then STD should be in IT department. Otherwise, STD should be in Finance department. o If STD's GPA is greater than or equal to 85 then set the salary to 500, otherwise, the salary is 450. Declare a new Employee object called (freshGrad) to hire STD in the company. O
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