Fri Jun 12, 2009 10:19 am
Sun Jun 14, 2009 2:21 am
Mon Jun 15, 2009 7:08 pm
class employee
{
private:
struct EmployeeRecord
{
string EmpName;
string EmpDOB;
string EmpJob;
int EmpID;
double EmpSalary;
};
EmployeeRecord Emp[100];
public:
employee(void);
void addEmployee(int EmpCounter);
void deletEmployee(int EmpCounter);
void showEmployeeRecords(int EmpCounter);
};
employee::employee(void)
{ }
void employee::addEmployee(int EmpCounter)
{
cout<<"Enter Employee ID Number:"<<endl;
cin>>Emp[EmpCounter].EmpID;
cout<<"Enter Employee Name:"<<endl;
cin>>Emp[EmpCounter].EmpName;
cout<<"Enter Employee Birth Day:"<<endl;
cin>>Emp[EmpCounter].EmpDOB;
cout<<"Enter Employee job:"<<endl;
cin>>Emp[EmpCounter].EmpJob;
cout<<"Enter Employee Salary:"<<endl;
cin>>Emp[EmpCounter].EmpSalary;
}
void employee::deletEmployee(int EmpCounter)
{
int RecordNo;
int DeletedEmpID;
RecordNo=0;
cout<<"Enter Staff Number:"<<endl;
cin>>DeletedEmpID;
for(int i=1;i<=EmpCounter;i++)
{
if(Emp[i].EmpID==DeletedEmpID)
{
RecordNo=i;
break;
}
}
if (RecordNo==0)
{
cout<<"Employee ID is Not Correct!!"<<endl;
}
else
{
for (int j=DeletedEmpID;j<=EmpCounter;j++)
{
Emp[j].EmpID = Emp[j+1].EmpID;
Emp[j].EmpName = Emp[j+1].EmpName;
Emp[j].EmpJob = Emp[j+1].EmpJob;
Emp[j].EmpDOB = Emp[j+1].EmpDOB;
Emp[j].EmpSalary = Emp[j+1].EmpSalary;
}
}
}
void employee::showEmployeeRecords(int EmpCounter)
{
cout <<"Employee Recordes"<<endl;
cout <<"================================"<<endl;
for (int j=1;j<=EmpCounter;j++)
{
cout <<"Employee ID: "<<Emp[j].EmpID<<endl;
cout <<"Employee Name: "<<Emp[j].EmpName<<endl;
cout <<"Employee Job: "<<Emp[j].EmpJob<<endl;
cout <<"Employee Date of Birth: "<<Emp[j].EmpDOB<<endl;
cout <<"Employee Salary: "<<Emp[j].EmpSalary<<endl;
cout <<"================================"<<endl;
}
}
this is empoyee class but i do not if is correct or not
but how i can do inheritence from it as i explain last time for admin and for programmer, admin make -insert new admin
-remove admin
-insert employee
-delete employee
-caculate working hours of employee
and programmer
make
add new programmer
-remove programmer
-check in (time that they come employee)
-check out(time that they leave employee)
and how create object in main program
thanks so much for reply
i have just approximetly 12 days to submit project to teacher and i study parttime and i study basic things only
thanks again.
Wed Jul 22, 2009 5:23 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.