Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I just need the questions at the end 1-5 answered, please !!!!!!! put the whole thing just in case you need the info This is

I just need the questions at the end 1-5 answered, please !!!!!!! put the whole thing just in case you need the info

This is C++ !!!!!!

PROJECT ( Inheritance: Class Employee and Class Salaried Employee )

Objective To derive a class from another class.

PROJECT DESCRIPTION

Write a program that contains two classes, one named Employee being a base class for all employees and a derived class named SalaryEmp whose objects will be salaried employees. Then instantiate class objects and generate an output, according to the requirements given below.

Information about This Project

This particular project uses the principles of inheritance.

Steps to Complete This Project

STEP 1 Implement Class Construction

First, construct a class named Employee whose data members include: two string members named empID and empName; two float members named hourlyRate and grossPay ; and one integer member named hoursWorked . Declare all these data members as protected . Also, include the following member functions in your class definition: a constructor that displays a message to the user indicating that an employee is being constructed; a void type function named Display() , which displays the employee record, as sampled below; a void type SetEmpID() function which sets the employee identification number; a string type function named GetEmpID(), which returns the employee ID ; a void function named SetName() which sets the employees name; a string type function named GetName() which returns the employees name; a void type function SetHourlyRate() which sets the hourly rate; a float type function named GetHourlyRate() which returns the hourly rate; a void type function SetHoursWorked() which returns the hours worked and an integer type function named GetHoursWorked() which returns the hours worked; a float type function named GetGrossPay() which returns the gross pay.Declare all these base class function members as public . Prior to defining a derived class, inheritance test drive your class by instantiating an object in the main() program using the sample data below.

Employee Record

Hourly Wage Employee

ID Number

805

Name

Sammy Student

Hours Worked

38

Hourly Wage

$ 10.00

PROJECT ( Inheritance: Class Employee and Class Salaried Employee )

STEP 2 Implement Inheritance

After you have tested your base class code, derive a class, through public derivation, called SalaryEmployee which has one float type private data member named annualSalary . The derived class has five member functions, which include: a derived class constructor, which display a message to the user that a salaried employee is being constructed; a float return type function named GetGrossPay() that returns the bi - weekly gross pay of a salaried employee, by dividing the annual salary divided by 26 payroll periods; a void return type function named Display() which displays the salaried employee record, as sampled below; a void function named SetAnnualSalary() which sets the annual salary of a derived class object; and a float return type function named GetAnnualSalary() which returns the employees annual salary. Declare all these derived class function members as public. Test drive your class by instantiating a derived class object in the main() program using the sample data below.

Employee Record

Salaried Employee

ID Number

837

Name

Samantha Student

Annual Salary

$ 38,000.00

STEP 3 Submit Your Completed Project

Submit any relevant outputs to this program, including the bi-weekly gross pay of Samantha Student, and your source code for credit. As an example of inheritance, examine the class definitions given below, which illustrate the inheritance of an Hourly Employee, instead of a Salaried Employee as required by this project.

class Employee {

protected:

char name[size];

int number;

public:

Employee();

void getName(char theName[]);

int getNumber();

};

class HourlyEmp : public Employee {

private:

float wageRate;

public:

HourlyEmp();

float getWageRate() const; // use const so as not to change member values

};

STEP 4 Questions and Answers Concerning this Computer Project

Answer the following questions in your own words.

Open MS Word and, within your lab submittal document, place your responses to each of these questions. Submit your completed MS Word document for credit.

(1) Aside from hourly employees, what other sub - classes could you have derived from the parent class Employee ?

(2) If you constructed a class derivation diagram for this Application, how would you situate or depict the relationships of the classes that comprise the program?

(3) Create modified code to include a bonus for salaried employees,and place below along with a snapshot of the output.

[ Hint: bonuses are generally given to salaried employees; have the end - of - year bonus of one - half percent of the annual salary added to the annual salary ] . (C++)

(4) If you constructed a UML diagram for this application, what data members would you declare as public ?

(5) If you constructed a UML diagram for this application, which data members would you declare as private ?

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

Development Of Knowledge Framework For Affective Content Analysis

Authors: Swarnangini Sinha

1st Edition

B0CQJ13WZ1, 979-8223977490

More Books

Students also viewed these Databases questions

Question

2. What efforts are countries making to reverse the brain drain?

Answered: 1 week ago