CS304 Assignment 2 Solution Guideline Spring 2021 | 100% correct Solution Guideline with code. CS304 Assignment 2 Solution Guideline Spring 2021 | 100% correct Solution Guideline with code | Link #CS304 #OOP #Spring2021 #Assginment 2 You are hired as an Application developer for a company called XYZ to facilitate the Human resource Management Department (HRM) to keep employee record. You are requested to write a program for HRM department to keep record of maximum 10 employees. Following is a menu and step by step guidance.
CS304 Assignment No 2 Spring 2021
Welcome to Human Resource Management (HRM) Software of Company XYZ. To do specific task please choose one of the following commands. 1. Add new employee 2. Delete employee information 3. Update employee information 4. Quit Please enter the related number of your requested command? Consider the following part of Person class which is containing some data members in it.
Class Person should include following private fields:
- • FirstName (String)
- • LastName (String)
- • PersonalID (Integer)
- • Salary (Double)
Class Person should have public member functions for setting and getting the private fields. Member functions should have the following naming style:
- • set_FieldName()
- • get_FieldName()
The field “PersonalID” of class Person should be unique and auto-increment with the initial value of 8248001 for the first employee. It means that user should not enter the value for “personalID”.
Class HRM should include following private fields:
Array of employees with the type Person (Private) • The actual number of employees which is stored in Array of employees(private) Class HRM should include following public member functions:
- • AddPerson()
- • DeletePerson(…)
- • UpdatePerson(…)
CS304 Assignment 2 Solution Guideline Spring 2021 | 100% correct Solution Guideline with code
This is sample code and partial solution . Watch video guideline and complete it. No Ready made solutions will be provided here.
#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=8248001;
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;
}