View Single Post
  #4  
Old 25-09-2008, 12:58 AM
BSIT07-01's Avatar
BSIT07-01 BSIT07-01 is offline
Addicted to Computer


 
Join Date: Sep 2007
Location: ------------
Age: 36
Posts: 1,309
Contact Number: ---------------
Program / Discipline: BSIT
Class Roll Number: 07-01
BSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant future
Default Re: Assignment Questions from Exercise:6

Solution of Exercise 6 in rough format but is working...
Bari Mushkil say bana hay...

Code:
#include <iostream>

#include<conio.h>
using namespace std;

char ch;

class employee
{
private:

enum etype{laborer,secretary,manager,accountant,executive,researcher};
etype x;
int employeeno;
float compensation;

class date
{
private:
int day,month,year;


public:
void getdate(int count)
{
cout<<"enter "<<count<<" Date : ";

cin>>day>>ch>>month>>ch>>year;


}
void showdate()
{
cout<<day<<ch<<month<<ch<<year<<endl;

}
};
public:

    date var;
    void putemploy()
    {
        static count=1;
        cout<<"Enter Employ "<<count<<" Number";
        cin>>employeeno;
        cout<<"Enter "<<count<<" Compensation";
        cin>>compensation;
        var.getdate(count);
        cout<<"enter "<<count<<" Employee Type";
        count++;
        
        switch(getch())
        {
        case 'l': x=laborer ; break;
        case 's': x=secretary ; break;
        case 'm': x=manager ; break;
        case 'a': x=accountant; break;
        case 'e': x=executive ; break;
        case 'r': x=researcher;
        
        }
        cout<<endl;
        



    }
    void getemploy()
    {
    cout<<"Employ No :"<<employeeno<<endl;
    cout<<"Employ Compensation : "<<compensation<<endl;
    cout<<"Employ Date : ";
    var.showdate();
    cout<<"Employ Type: ";

    switch(x){
    case 0: cout<<"laborer\n" ; break;
    case 1: cout<<"secretary\n" ; break;
    case 2: cout<<"manager\n" ; break;
    case 3: cout<<"accountant\n"; break;
    case 4: cout<<"executive\n" ; break;
    case 5: cout<<"researcher\n"; break;
    default: cout<<"Undefined\n";}}



};

void main()
{



    employee x[3]; 

for(int i=0; i<3;i++){

x[i].putemploy();
}

for(int j=0; j<3; j++)
 {
    x[j].getemploy();
}





}

Reply With Quote