Write a program that create a model of employee by using Classes, Program should be able to add, delete, modify and View the Record by using member functions.
Program must contain following attributes.
· Name
· Age
· Gender
· Salary
· EmployeeID
#include <iostream>
#include <conio.h>
#include <string>
#include <vector>
using namespace std;
class Employee
{
public:
Employee(string Name ,int Age, string Gender, int Salary, int EmployeeID) {
this->Name = Name;
this->Age = Age;
this->Gender = Gender;
this->Salary = Salary;
this->EmployeeID = EmployeeID;
Baza.push_back({ this->Name,to_string(this->Age), this->Gender,to_string(this->Salary),to_string(this->EmployeeID) });
};
void ADD(string Name, int Age, string Gender, int Salary, int EmployeeID) {
Baza.push_back({ Name,to_string(Age), Gender,to_string(Salary),to_string(EmployeeID) });
}
void DELETE(int row) {
vector<vector<string>> prom;
for (int i = 0; i < Baza.size(); ++i)
if (i != row)
prom.push_back(Baza[i]);
Baza = prom;
}
void MODIFY(int row, int param, string Znach) {
Baza[row][param] = Znach;
}
void VIEW() {
for (int i = 0; i < Baza.size(); ++i) {
for (int j = 0; j < Baza[i].size(); ++j)
cout << Baza[i][j] << " ";
cout << endl;
}
}
private:
vector<vector<string>> Baza;
string Name;
int Age;
string Gender;
int Salary;
int EmployeeID;
};
int main() {
Employee B("Alex", 18, "Male", 1000,1);
_getch();
return 0;
}
Comments
Dear Ali raza, please post a new question
Write a program that calculates the GPA of a subject by using classes. Program should be able to add, delete, modify and View the Record.
Leave a comment