// Justin C. Miller
// University of Wisconsin Oshkosh
// Made for: http://www.geocities.com/neonprimetime.geo/index.html
// Date: 2001
// Borland Builder 4.0
// this program is for an employee
// that has a name, m/f and pay per hour
// cacluates pay for a job
#include
#include
class employee
{
private:
char * name ;
char male_or_female ;
double pay_per_hour;
public:
employee() ;
~employee() ;
double CalculatePay(double) ;
void DisplayInformation() ;
void SetInformation() ;
};
employee::employee()
{name = new char[30] ; male_or_female = '\0' ; pay_per_hour = 0 ;}
employee::~employee()
{delete name ;}
// this function recieves the #hours worked
// returns the total pay recieved
double employee::CalculatePay(double hours)
{
return (pay_per_hour * hours) ;
}
void employee::SetInformation()
{
cout << "Please enter the employee first name..." << endl ;
cin >> name ;
cout << "Please enter the 'm' for male or 'f' for female..." << endl ;
cin >> male_or_female ;
cout << "Please enter a the amount of pay " << name << " makes per hour.." << endl ;
cin >> pay_per_hour ;
}
void employee::DisplayInformation()
{
cout << "Employee name is "<< name << " (" << male_or_female << ")" << endl ;
// determines if male or female to say he/she
if(male_or_female == 'm') cout << "He " ;
else cout << "She " ;
cout << " makes $" << pay_per_hour << " per hour." << endl ;
}
int main()
{
employee john ;
john.SetInformation() ;
john.DisplayInformation() ;
int hours ;
cout << "Please enter the number of hours worked... " << endl ;
cin >> hours ;
cout << "John worked on a job for " << hours << " hours." << endl ;
cout << "He made $" << john.CalculatePay(hours) << endl ;
getch() ;
return 0 ;
}
               (
geocities.com/neonprimetime.geo/cpp)                   (
geocities.com/neonprimetime.geo)