View Single Post
Old May 22nd, 2006, 10:00 PM   #9
Mack1982
Programmer
 
Join Date: Dec 2004
Posts: 34
Rep Power: 0 Mack1982 is on a distinguished road
This is the Entire Question
Begin with creating the Employee class.

In a separate header file called Employee.h, construct a class named Employee. 

This class will have the following data-members:

fName. // An object of type char array used to hold the Employee's first name 
lName. // An object of type char array used to hold the Employee's last name 
address. // An object of type char array used to hold the Employee's address 
ssn. // An object of type char array used to hold the Employee's social security number 
hours. // An object of type double used to hold the Employee's hours worked 
payRate. // An object of type static  double used to hold the payRate 
empCount/ // an object of type static int that will count the number of Employee objects created 
This class will have the following member functions:

A no parameter constructor that will set all char arrays to blanks and all instance numeric variables to 0. 
A four parameter constructor that will accept parameters in this order 
1.      A parameter for the first name

2.      A parameter for the last name

3.      A parameter for the address

4.      A parameter for the social security number 

·   The following Non I/O modifiers:

1.      void setFName(char n[]). This will modify the fName member

2.      void setLName(char n[]). This will modify the lName member

3.      void setAddress(char n[]). This will modify the address member

4.      void setSsn(char n[]). This will modify the ssn member

5.      void setHours(double n). This will modify the hours member

 ·   The following I/O modifier

1.      void read(). This will allow user input into all the instance data-members

 ·  The following accessors:

1.       char* getFName()   for the fName member

2.      char * getLName()

3.      char* getSsn()

4.      char* getAddress()

5.      double getHours()

6.       void display() :  This will display the contents of one Employee object on one line.  In the following example, the number  35 refers to his hours, 12.00 refers to the pay rate and 420 is his salary.

 

 

123-45-6789   Brown      John     31 E.5th St.     35     12.00   420.00 

·   The following implementor:

1.      double calcSalary(). This will calculate and return a salary based on hours and payRate. Hours in excess of 40 are paid at time and a half

 

·  The following static functions:

1.      static void setPayRate(double rate). This will modify the static member

2.      static double getPayRate( ). This will return the payRate

3.      static double getEmpCount( ). This will return the empCount member 


Then using this class as a base class, implement the following classes 

1. HourlyWorker class: This class would be exactly like the base class.
2. SalaryWorker class. This class would possess a new data-member called yearlySalary that would contain the yearly salary of the worker. The worker would be paid on a bi-weekly basis in an amount equal to 1/26th of the yearly salary. All Salaried workers start with a default salary of $36,000.00. 

There must be the additional functions:
    a. double getYearlySalary(); // This would return the yearly salary of the worker
    b. void setYearlySalary(double sal); // This would set the yearly salary of the worker

3. Executive class. This class in addition to having a yearly salary has a bonus in a variable called bonus. The bi-weekly salary will be calculated at 1/26th of the yearly salary + 1/26th of the bonus. All executives start with a default bonus of $10,000.00 and a yearly salary of $50,000.00.

There must be additional functions: 
    a. double getYearlySalary(); // This would return the yearly salary of the worker
    b. void setYearlySalary(double sal); // This would set the yearly salary of the worker
    c. double getBonus(); // This would return the bonus of the worker
    d. void setBonus(double bonl); // This would set the bonus of the worker.


Please note that all functions must be able to be accessed from a base class pointer. This would of course require some changes in the base class. 
Hint: The base class would become an abstract class.

Write a main function that implements a simple menu that would:
• Add an employee 
• List Employees
• Quit

When adding an employee, give the User the choice of which type of Employee to add (HourlyWorker, SalaryWorker or Executive). Create the object dynamically and attach it to a list of Employee pointers.

Question: With the stated Functions and datatypes is it possible to create a list? Or do i have to use somthing else like Structs,....??
Mack1982 is offline   Reply With Quote