| | |
Employees
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2009
Posts: 8
Reputation:
Solved Threads: 0
C++ Syntax (Toggle Plain Text)
You are to design a class class called Employer data members: char name[] long int ID double salary , and two constructors _Default construtor Person () _Copy constructor Person ( char n[30],long int id,double s) _setPerson (char n[30],long int id,double s) that allows user to set information for each person You have to define two classes that derived from class Employee, called Manager and Secretary correspondingly. Each class should inherit all members from the base class and has its own data members and member function as well. For example the Manager should have a data member called degree for his/her undergraduated degree (e.g. diploma, bachelor, master, doctor), the Secretary should have her contract (permanent, temporary). All member functions of derived class should be overiided from their base class. Each derived class should have an operator << which allows user to output a person’s information to the screen. Write the following main() to test your classes int main() { Person p(“Vinh Nguyen”,1234567,500.0); Manager p1(“An Nguyen Vinh”, 0234567, 1000, Dr.); Secretary p2; p2.setPerson(“Lan Vu”, 0341256, 400, permanent); cout << “Manager p1 is “ << p1; cout << “Secretary p2 is “ << p2; return 0; }
Help me !
Might want to try it yourself first looks like the description is pretty detailed. I'll wait while you give it a shot.
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: Apr 2009
Posts: 8
Reputation:
Solved Threads: 0
C++ Syntax (Toggle Plain Text)
class Employee { public: Employee(string theName, float thePayRate); string getName() const; float getPayRate() const; float pay(float hoursWorked) const; protected: string name; float payRate; }; Employee::Employee(string theName, float thePayRate) { name = theName; payRate = thePayRate; } string Employee::getName() const { return name; } float Employee::getPayRate() const { return payRate; } float Employee::pay(float hoursWorked) const { return hoursWorked * payRate; }
See, you're more than capable of doing what the description says, you're just overthinking it. Follow the directions closely and read in your book about Inheritance and Operator Overloading and you'll have it done in no time.
(You're probably thinking I'm being mean by not giving you the answer but if you don't learn now you'll just keep needing help)
(You're probably thinking I'm being mean by not giving you the answer but if you don't learn now you'll just keep needing help)
GCS d- s+ a-->? C++(++++) UL+++ P+>+++ L+++ E--- W+++
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
N+ o K w++(---) O? !M- V PS+>++ PE+ Y+ PGP !t- 5? X- R tv+
b+>++ DI+ D G++>+++ e+ h+>++ r y+
PMs asking for help will not be answered, post on the forums. That's what they're there for.
•
•
Join Date: Apr 2009
Posts: 8
Reputation:
Solved Threads: 0
My solution :
Please help me complete classes !
C++ Syntax (Toggle Plain Text)
class Employee { public: Employee(const char* aName, const Manager* aManager); const char* name(void) const; const Manager* manager(void) const; private: const char* theName; const Manager* theManager; }; class Manager : public Employee { public: Manager(const char* aName, const Manager* aManager, Secretary* aSecretary = 0); void setSecretary(Secretary* aSecretary); Secretary* secretary(void); private: Secretary* theSecretary; }; class Secretary : public Employee { public: Secretary(const char* aName, const Manager* aManager); };
Please help me complete classes !
![]() |
Similar Threads
- How to Get Best Of Employees (IT Professionals' Lounge)
- copy constructor problem (C++)
- limitations of 10 employees per page (C)
- Minimizing Outlook 2000 to the systray in Windows 2000 Pro (Windows Software)
- question (C++)
- Group Project Ideas (Geeks' Lounge)
Other Threads in the C++ Forum
- Previous Thread: Dynamic Memory Question
- Next Thread: C++ finding measurements of circle
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






