Hello guys,
I have a basic program due today. This is the Text of the project. For some reason ,I keep getting an error code. The code is posted below the text of the project. i would appreciate if someone can help me out with whats wrong with my code. Thanks! At the very minimum, since this code is due today, I need it at least to have a base class and declaration so I can receive at least 70 out of the 100 points.
"
Project #1 DUE Feb 25 4:15 pm.
This is a database of employees and managers.
Base class EMPLOYEE has these private data members: NAME, SALARY, YEAR_HIRED.
Each of these should be a an array of size 10.
Derived class MANAGER has one private data member STAFF of size 5.
Declare one instance of EMPLOYEE and 2 instances of MANAGER.
Assign employees #1- 5 to Manager1 and employees #6-10 to Manager2.
Employees have name, salary, year_hired. Managers have name, salary, year_hired, staff.
Main program should initialize 10 employees and allow user to output employee records and make changes. User should also be able to list all employees on staff of a given manager as a report.
Class should be in header file. If this is complete by deadline 100 pts.
"
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
|
#include <iostream>
#include <string>
#include <conio.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
class employee{
private:
float salary{10};
char name{10};
double year_hired{10};
public:
void getemptdetails()
{
cout << "\n Enter the employee name." <<endl;
cin >> name;
cout <<" \n Enter the year hired" << endl;
cin >> year_hired;
cout << "\n Enter the salary of the employee." <<endl;
cin >> salary;
}
void showemptdata()
{
cout << " \n The name of the employee:" << name;
cout << " \n The salary of the employee:" << salary;
cout << " \n The year hired of the employee:" << year_hired;
}
};
int main()
{
//create object for class
employee e1;
e1.getemptdetails(); //call member functions
e1.showemptdata();
_getch();
}
(System "pause")
return 0;
}
|