code Help* Please

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2007
Posts: 3
Reputation: hpr12951 is an unknown quantity at this point 
Solved Threads: 0
hpr12951 hpr12951 is offline Offline
Newbie Poster

code Help* Please

 
0
  #1
Dec 6th, 2007
Hello~I am having trouble with my homework.
I could not have them done. Please Please help me with it.
Thank you all. God bless...



The question is
""Add temporary, administrative, permanent, and other classifications of employees to the hierarchy from the three coding. Implement and test this hierarchy. Test all member functions. A user interface with a menu would be a nice touch for your test program.""


Here are 3 coding.
  1. "-----------First
  2.  
  3. //This is the header file employee.h.
  4. //This is the interface for the class Employee.
  5. //This is primarily intended to be used as a base class to derive
  6. //classes for different kinds of employees.
  7. #ifndef EMPLOYEE_H
  8. #define EMPLOYEE_H
  9.  
  10. #include <string>
  11. using std::string;
  12.  
  13. namespace SavitchEmployees
  14. {
  15.  
  16. class Employee
  17. {
  18. public:
  19. Employee( );
  20. Employee(string theName, string theSsn);
  21. string getName( ) const;
  22. string getSsn( ) const;
  23. double getNetPay( ) const;
  24. void setName(string newName);
  25. void setSsn(string newSsn);
  26. void setNetPay(double newNetPay);
  27. void printCheck( ) const;
  28. private:
  29. string name;
  30. string ssn;
  31. double netPay;
  32. };
  33.  
  34. }//SavitchEmployees
  35.  
  36. #endif //EMPLOYEE_H
  37.  
  38. -----------"
  39.  
  40. "------Second
  41. //This is the header file hourlyemployee.h.
  42. //This is the interface for the class HourlyEmployee.
  43. #ifndef HOURLYEMPLOYEE_H
  44. #define HOURLYEMPLOYEE_H
  45.  
  46. #include <string>
  47. #include "employee.h"
  48.  
  49. using std::string;
  50.  
  51. namespace SavitchEmployees
  52. {
  53.  
  54. class HourlyEmployee : public Employee
  55. {
  56. public:
  57. HourlyEmployee( );
  58. HourlyEmployee(string theName, string theSsn,
  59. double theWageRate, double theHours);
  60. void setRate(double newWageRate);
  61. double getRate( ) const;
  62. void setHours(double hoursWorked);
  63. double getHours( ) const;
  64. void printCheck( ) ;
  65. private:
  66. double wageRate;
  67. double hours;
  68. };
  69.  
  70. }//SavitchEmployees
  71.  
  72. #endif //HOURLYMPLOYEE_H
  73.  
  74. -----------"
  75.  
  76.  
  77.  
  78. "---------Third
  79. //This is the header file salariedemployee.h.
  80. //This is the interface for the class SalariedEmployee.
  81. #ifndef SALARIEDEMPLOYEE_H
  82. #define SALARIEDEMPLOYEE_H
  83.  
  84. #include <string>
  85. #include "employee.h"
  86.  
  87. using std::string;
  88.  
  89. namespace SavitchEmployees
  90. {
  91.  
  92. class SalariedEmployee : public Employee
  93. {
  94. public:
  95. SalariedEmployee( );
  96. SalariedEmployee (string theName, string theSsn,
  97. double theWeeklySalary);
  98. double getSalary( ) const;
  99. void setSalary(double newSalary);
  100. void printCheck( );
  101. private:
  102. double salary;//weekly
  103. };
  104.  
  105. }//SavitchEmployees
  106.  
  107. #endif //SALARIEDEMPLOYEE_H
  108.  
  109. ------"
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 751
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: code Help* Please

 
0
  #2
Dec 6th, 2007
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,679
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 193
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: code Help* Please

 
0
  #3
Dec 6th, 2007
At least one
Everyone's gotta believe in something. I believe I'll have another drink.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,578
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1486
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is online now Online
Still Learning

Re: code Help* Please

 
0
  #4
Dec 7th, 2007
>>I could not have them done
Does that mean no one else will do your homework so now you are begging us to do it ? I don't think you will find anyone here willing to do your homework either.

Hint: I think what your assignment is asking you to do is derive more classes from those aready derived, such as derive tempSalaried from SalariedEmployee and tempHourly from HourlyEmployee. But then I could be completly wrong too.
Last edited by Ancient Dragon; Dec 7th, 2007 at 12:25 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 1,857
Reputation: ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all ithelp is a name known to all 
Solved Threads: 120
ithelp's Avatar
ithelp ithelp is offline Offline
Posting Virtuoso

Re: code Help* Please

 
0
  #5
Dec 7th, 2007
  1. int main(int argc, char **argv[]) {
  2. //now instantiate each classes
  3. // and invoke the member functions one by one
  4. return 0;
  5. }
Last edited by ithelp; Dec 7th, 2007 at 7:51 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC