944,203 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 649
  • C++ RSS
Dec 6th, 2007
0

code Help* Please

Expand Post »
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.
C++ Syntax (Toggle Plain Text)
  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. ------"
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hpr12951 is offline Offline
3 posts
since Dec 2007
Dec 6th, 2007
0

Re: code Help* Please

Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
Dec 6th, 2007
0

Re: code Help* Please

At least one
Reputation Points: 1268
Solved Threads: 228
Posting Virtuoso
vmanes is offline Offline
1,895 posts
since Aug 2007
Dec 7th, 2007
0

Re: code Help* Please

>>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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,963 posts
since Aug 2005
Dec 7th, 2007
0

Re: code Help* Please

c++ Syntax (Toggle Plain Text)
  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.
Reputation Points: 769
Solved Threads: 128
Banned
ithelp is offline Offline
1,910 posts
since May 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Help! Name outfile by variable
Next Thread in C++ Forum Timeline: search word in file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC