CS 304 -Assignment No. 2 Current Solution # 2021
#include <iostream>
#include <string>
using namespace std;
class Person{
private:
string FirstName;
string LastName;
int PersonalID;
double Salary;
public:
static int current_id;
//setter function
void setFirstName(string fn){
FirstName=fn;
}
void setLastName(string ln){
LastName=ln;
}
void setPersonalID(int pid){
PersonalID=pid;
}
void setSalary(double sl){
Salary=sl;
}
//Gettter function
string getFirstName(){
return FirstName;
}
string getLastName(){
return LastName;
}
int getPersonalID(){
return PersonalID;
}
Person() : PersonalID(current_id++) {}
};
int Person::current_id=256;
class HRM{
private:
Person employee;
public:
void AddPerson(string, string, double);
void DeletePerson();
void UpdatePerson();
string displayFN(){
return employee.getFirstName();
}
string displyLN(){
return employee.getLastName();
}
void displaySal();
void displayID();
};
void HRM::AddPerson(string fn, string ln, double sal){
employee.setFirstName(fn);
employee.setLastName(ln);
employee.setSalary(sal);
}
int main(){
HRM h1;
string fn, ln;
double sal;
cout<<“Enter First Name :” ;
cin >> fn;
cout<<“Enter last Name : “;
cin>>ln;
cout<<“Salar : “;
cin>>sal;
h1.AddPerson(fn,ln,sal);
cout<<endl<<“First Name\t\tLast Name \t\t Personal ID\t\tSalary per Year(Rupees)”<<endl;
cout<<endl<<“————-\t\t—————\t\t ————–\t\t———————“<<endl;
cout<<endl<<h1.displayFN()<<“\t\t”<<h1.displyLN()<<endl;
}
CS 304 -Assignment No. 2 Current Solution # 2021
More Assignments:
I am extremely impressed with your writing skills as well as
with the layout on your weblog. Is this a paid theme or did you customize
it yourself? Anyway keep up the excellent quality writing, it’s rare to see a nice blog
like this one these days.
What’s up mates, good paragraph and nice urging commented at this place, I am really enjoying
by these.