Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > The IT Pro > Programming
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Programming A discussion forum for programs and programming used in tech-related businesses.

Reply
 
LinkBack Thread Tools
Old 05-19-2009, 07:29 AM   #1 (permalink)
Registered User
 
Join Date: May 2009
Posts: 6
OS: 2


Arrow Employee

I am new at C++ and I am having a lot of trouble understanding it. The following is a

homework assignment due this week and I have not idea how to even start it much less

finish coding it. Can anyone out there help?


Code:
You are to design a class called Employee 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;
}

Thanks in advance !
effective is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 05-19-2009, 02:21 PM   #2 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros


Re: Employee

Hey, and welcome to TSF. Although we don't do homework i will point you to something that will sort you out =]...

http://www.cprogramming.com/tutorial.html#c++tutorial is a set of free online C++ tutorials, once you've gotten to the 12th you'll be proficcient enough to complete your assignment. It should take between 1 and 3 nights of work so you'll finish within your deadline. And of course if you encounter any problems during the process you can post them in this forum and we'll help you out.

Cheers,
Jamey
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-22-2009, 08:14 PM   #3 (permalink)
Registered User
 
Join Date: May 2009
Posts: 6
OS: 2


Re: Employee

my email : ***************
you can send full code to this email. thanks in advanced !

Last edited by Indoril Nerevar; 05-23-2009 at 04:25 AM. Reason: removed email
effective is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-23-2009, 03:53 AM   #4 (permalink)
Design Team Member
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 1,854
OS: Vista, various linux distros


Re: Employee

I said we don't do homework, so that's not gonna happen. Go and learn to code yourself.
__________________

Myspace
jamiemac2005 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-23-2009, 04:26 AM   #5 (permalink)
Manager, Games Team
 
Indoril Nerevar's Avatar
 
Join Date: Jan 2006
Location: Queensland, Australia
Posts: 5,003
OS: Windows 7 RC 64-bit

My System

Re: Employee

Your textbook would probably be the best place to start.
__________________


Donating to the forum keeps TSF free for all.

Common PC Game IssuesCommon Installation IssuesPosting System SpecsPower Supply Information
NVIDIA Drivers ATI DriversThermal Paste GuideSystem Requirements LabYouGamers Game-o-Meter

EverestPrime95DirectXAMD DriversMemtest86SensorsViewDriver Cleaner

I do not give help via PM. Please post your question on the forum.
Indoril Nerevar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-23-2009, 09:38 PM   #6 (permalink)
Registered User
 
Join Date: May 2009
Posts: 6
OS: 2


Re: Employee

My solution :
Code:
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 !
effective is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 08:21 AM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85