Firstly, apologies for the lack of commenting, it will be commented when the program works properly (lol), I'm creating a program which creates a test harness for 3 subjects, employees. This will display their name, ID and payrate per hour, it will then calculates the total amount in 37.5hours.
Again, apologies for 0 comments and crude code.
Any help would be greatly appreciated
#include <iostream>
using namespace std;
class emp
{
private:
char empname[25];
char empid[10];
char rate[20];
char total[10];
public:
void getDetails()
{
cout<<"Employee Name: \n" << empname;
cout<<"Employee ID: \n" << empid;
cout<<"Hourly Rate: \n" << rate;
}
void setDetails()
{
cout<<"Employee Name: Smith \n";
cin.getline(empname,25);
cout<<"Employee ID: BR0900 \n";
cin.getline(empid,10);
cout<<"Hourly Rate: £6.30 \n";
cin.getline(rate,20);
cout<<"Employee Name: Talbot \n";
cin.getline(empname,25);
cout<<"Employee ID: MA0640 \n";
cin.getline(empid,10);
cout<<"Hourly Rate: £5.40 \n";
cin.getline(rate,20);
cout<<"Employee Name: Adams \n";
cin.getline(empname,25);
cout<<"Employee ID: SA0120 \n";
cin.getline(empid,10);
cout<<"Hourly Rate: £12.00 \n";
cin.getline(rate,20);
cout<<"Total Pay: £888.75 \n" << rate;
cin.getline(rate,10);
}
};
int main()
{
empname empname1;
empid empid1;
rate rate1;
empname1.setDetails();
empid1.setempidDetails();
rate1.setrateDetails();
empname1.getDetails();
empid1.getempidDetails();
rate1.getrateDetails();
return 0;
}