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_2

Step: 3

blur-text-image_3

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

IBM Db2 11 1 Certification Guide Explore Techniques To Master Database Programming And Administration Tasks In IBM Db2

Authors: Mohankumar Saraswatipura ,Robert Collins

1st Edition

1788626915, 978-1788626910

More Books

Students also viewed these Databases questions

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago

Question

manageremployee relationship deteriorating over time;

Answered: 1 week ago