Question: Q1: Create a class Employee having private data members firstname as string, lastname as string and SSN(social security number) as string. Write getter and setter

Q1: Create a class Employee having private data members firstname as string, lastname as string and SSN(social security number) as string. Write getter and setter function for these data members. Also write default and parameterized constructor for this class. Write pure virtual function double Earnings(). Write another virtual function voidPrint() which prints first name, last name and SSN of Employee. Class SalariedEmployee derived from Employee class. Private Data Member for this class is weeklySalary as double. The public member functions include a constructor that initializes first name, last name, SSN (social security number) and weekly salary; a set function to assign a new non negative value to data member weeklySalary; a get function to return weeklySalary's value to the calling program. Function double Earnings() overrides pure virtual function of Employee class to provide a concrete implementation that returns the SalariedEmployee's weeklySalary. Function Print() of class SalariedEmployee overrides Employee function void Print(). For this, call Employee Print function and getter of weeklySalary in this function. Class HourlyEmployee is also derived from class Employee . Private Data members for this class are hours and wage of type double. The public member functions include a constructor that initialize first name, last name, SSN (social security number), an hourly wage and the number of hours worked; set function that assign new values to data members wage and hours (hours takes value from 0 to 168 and wage is non-negative), respectively, get functions to return the values of wage and hours, respectively. Function double Earnings() overrides pure virtual function of Employee class to provide a concrete implementation that returns wage x hours if hours less than 40 else return 40 x wage + ( ( hours - 40 ) x wage x 1.5 ); Now Function void Print() of class HourlyEmployee overrides Employee class function void Print(). For this call Employee Print function and return wage. In main()create objects of child classes and Parent and call Earning() and Print() functions along with their name and SSN. Also elaborate if polymorphism is being implemented here...

in c++ language..

object oriented programming..

Q2: Create a class template for a class named GeneralStack that holds [4] A single data member as an array named stack of size 50 to store certain elements A constructor to initialize stack with value 0 or 0.0 at all its indexes Three member functions i.e. push(type) to add elements in the Stack, pop() to remove elements from the stack, and currentStatus() to check whether the array is filled or not. (A filled array is an array that has non-zero value at all of its indexes). In the main() function, create three objects with different data types of class GeneralStack and test the functionality of member functions for various values of data members for these objects.

in c++ language..

object oriented programming..

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!