Prof. I. Rudowsky CISC 3110 TY3

Prof. I. Rudowsky CISC 3110 TY3

<p>Prof. I. Rudowsky CISC 3110 TY3 Homework #4 – Due April 7, 2011</p><p>You will begin with a class name Employee that contains the following code: class Employee{ private: char *name; public: Employee() { } Employee(char *n) { name = new char[strlen(n)+1]; strcpy(name,n); } void printEmployee() { cout<<"Employee name: "<<name<<endl; } }; Employee</p><p>Full Time Part Time</p><p>Executive</p><p>1. From the above picture you can see that Employee has two subclasses and FullTime has its own subclass. 2. FullTime has its own private data member called salary a. Its constructor has two parameters (name and salary) which invokes the constructor for Employee b. It has a function printFullTime that invokes the printEmployee function and also prints the salary c. It has a function printWages that calls printFullTime 3. PartTime has a private data member hourlyWage a. Its constructor has two parameters (name and hourly wage) which also invokes the constructor for Employee b. It has a function printPartTime that invokes the printEmployee function and also prints the hourly wage c. It has a function printWages that calls printPartTime 4. Executive has a private data member bonus a. Its constructor has three parameters (name, salary and bonus) which also sets invokes the constructor for FullTime b. It has a function printExecutive that invokes the printFullTime function and also prints the bonus c. It has a function printWages that calls printExecutive 5. Your main program will contain the following code:</p><p> int main() { FullTime ft1 ("Nancy Smith",20500); ft1.printWages(); cout<<endl;</p><p>PartTime pt1("Frank Jones",12.75); pt1.printWages(); cout<<endl;</p><p>Executive ex1("George Bush", 150000, 32250); ex1.printWages();</p><p> return 0; }</p><p>6. When main executes, the output is as follows:</p><p>Wages for FullTime Employee name: Nancy Smith Fulltime annual salary: 20500</p><p>Wages for PartTime Employee name: Frank Jones Part-time hourly wage: 12.75</p><p>Wages for Executive Employee name: George Bush Fulltime annual salary: 150000 Executive bonus: 32250</p><p>7. Write the code for the the classes FullTime, PartTime and Executive in order to make this work</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us