Answer to Question #195070 in C++ for Azhar Maqsood

Question #195070

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



1
Expert's answer
2021-05-18T15:07:41-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

Assignment Expert
20.05.21, 14:37

Dear Ali raza, please post a new question



Ali raza
20.05.21, 14:16

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

LATEST TUTORIALS
New on Blog