A company hired staff for their different project sites. They must maintain a da
ID: 3861926 • Letter: A
Question
A company hired staff for their different project sites. They must maintain a database of all their employees which must include the following: Emp Service No, First Name, Middle Name, Last Name, NIC no, Age, Father's/Husband Name, Phone No 1, Phone No 2, Present Address, Permanent Address, Social Security No, EOBI Card No, Next of Kin, Monthly Salary, Hourly Rate, Bank Account No, Bank Name. in addition to the above information the company must maintain their years and months of service with them and the project site they were assigned, they may be transferred to different project locations, the company must maintain their history in this regard. The company must also maintain their salary appraisals which occur every year and must keep a record of previous appraisals. Your job would be to design a program keeping in mind the object-oriented approach and making sure that all complete data is searchable through various options.Explanation / Answer
//C++ PROGRAM
#include <iostream>
#include <string.h>
using namespace std;
class Contact
{
private:
long phoneNumber1;
long phoneNumber2;
string presentAddress;
string permanentAddress;
public:
Contact()
{
phoneNumber1 = 0;
phoneNumber2 = 0;
permanentAddress = "";
presentAddress = "";
}
Contact(long c_phn1, long c_phn2, string presentaddr, string permanentAddr)
{
phoneNumber1 = c_phn1;
phoneNumber2 = c_phn2;
permanentAddress = permanentAddr;
presentAddress = presentaddr;
}
string getPresentAddress()
{
return presentAddress;
}
string getPermanentAddress()
{
return permanentAddress;
}
long getPhoneNumber1()
{
return phoneNumber1;
}
long getPhoneNumber2()
{
return phoneNumber2;
}
string getContactDetails()
{
return " Present Address: " + presentAddress + " Permanent Address: " + permanentAddress + " Phone Number1: " + to_string(phoneNumber1)
+ " Phone Number2: " + to_string(phoneNumber2);
}
};
class Person
{
private:
string firstName;
string middleName;
string lastName;
int age;
string father_husband_Name;
string nextOfKin;
Contact *contactDetails;
public:
Person()
{
firstName = "";
middleName = "";
lastName = "";
age = 0;
father_husband_Name = "";
nextOfKin = "";
contactDetails = NULL;
}
Person(string f_Name,string m_Name,string l_Name,int p_age,string f_h_Name,string p_nextOfKin,long c_phn1, long c_phn2, string presentaddr, string permanentAddr)
{
firstName = f_Name;
middleName = m_Name;
lastName = l_Name;
age = p_age;
father_husband_Name = f_h_Name;
nextOfKin = p_nextOfKin;
contactDetails = new Contact( c_phn1, c_phn2, presentaddr, permanentAddr);
}
string getPersonDetails()
{
return " Name: " + firstName + " " + middleName + " " + lastName + " Age: " + to_string(age) + " Father/Husband's Name: "
+ father_husband_Name + " Next of Kin: " + nextOfKin + contactDetails->getContactDetails();
}
string getFirstName()
{
return firstName;
}
string getMiddleName()
{
return middleName;
}
string getLastName()
{
return middleName;
}
int getAge()
{
return age;
}
string getFatherorHusbandName()
{
return father_husband_Name;
}
string getNextOfKin()
{
return nextOfKin;
}
Contact getContact()
{
return *contactDetails;
}
};
class Employee: public Person
{
private:
string employeeServiceNo;
int NICNo;
string socialSecurityNo;
int EOBIcardNo;
double salary;
double hourlyrate;
long BankAccountNumber;
string BankName;
public:
Employee() : Person()
{
employeeServiceNo = "";
NICNo = 0;
socialSecurityNo = "";
EOBIcardNo = 0;
salary = 0;
hourlyrate = 0;
BankAccountNumber = 0;
BankName = "";
}
Employee(string f_Name,string m_Name,string l_Name,int p_age,string f_h_Name,string p_nextOfKin, string presentadd, string perma_addr, long ph1, long ph2, string em_ser_no, int nic_no, string ssno, int eobi_no, double sal, double rate, long ban_acc_no, string bank_name) : Person( f_Name, m_Name, l_Name, p_age, f_h_Name, p_nextOfKin, ph1, ph2, presentadd, perma_addr)
{
employeeServiceNo = em_ser_no;
NICNo = nic_no;
socialSecurityNo = ssno;
EOBIcardNo = eobi_no;
salary = sal;
hourlyrate = rate;
BankAccountNumber = ban_acc_no;
BankName = bank_name;
}
string getEmployeeServiceNo()
{
return employeeServiceNo;
}
int getNICNo()
{
return NICNo;
}
string getSocialSecurityNo()
{
return socialSecurityNo;
}
int getEOBINo()
{
return EOBIcardNo;
}
double getSalary()
{
return salary;
}
double getHourlyRate()
{
return hourlyrate;
}
long getBankAccountNumber()
{
return BankAccountNumber;
}
string getBankName()
{
return BankName;
}
string printEmployeeDetails()
{
cout<<getPersonDetails()<<" Employee Service No: "<<employeeServiceNo<<" NIC NO: "<<NICNo<<" Social Security No: "<<socialSecurityNo;
cout<<" EOBI No: "<<EOBIcardNo<<" Salary: "<<salary<<" Hourly Rate: "<<hourlyrate;
cout<<" Bank Account number: "<<BankAccountNumber<<" Bank Name: "<<BankName<<endl;
}
};
int main()
{
Employee *employees[10];
employees[0] = new Employee("William", "Christan", "Theodore", 26, "Morry Theodore", "Barry Theodore", "Welcome Street, Georgia", "Mani Street, Florida", 7248243, 9275544, "EDW1234", 037644, "YW6732", 86532, 8422, 60, 82357825782375, "ABC bank");
employees[1] = new Employee("James", "Maddison", "Welsh", 33, "Justin Welsh", "Fiona Welsh", "Palm Street, West Virginia", "Collin Street, New York", 8237395357, 39874983, "EDW2356", 463829, "YW2397", 46422, 6345, 40, 42659265892895, "ICICI bank");
employees[2] = new Employee("John", "F", "Smith", 34, "Tim Smith", "Teena Smith", "Grill Street, Hawaii", "Barack Street, Texas", 23858935, 84056867, "EDW1567", 87456, "YW2298", 76533, 4321, 30, 82375702454468, "HDC bank");
for(int i=0; i<3; i++)
{
employees[i]->printEmployeeDetails();
}
return 0;
}
/*
OUTPUT:
Name: William Christan Theodore
Age: 26
Father/Husband's Name: Morry Theodore
Next of Kin: Barry Theodore
Present Address: Welcome Street, Georgia
Permanent Address: Mani Street, Florida
Phone Number1: 7248243
Phone Number2: 9275544
Employee Service No: EDW1234
NIC NO: 16292
Social Security No: YW6732
EOBI No: 86532
Salary: 8422
Hourly Rate: 60
Bank Account number: 82357825782375
Bank Name: ABC bank
Name: James Maddison Welsh
Age: 33
Father/Husband's Name: Justin Welsh
Next of Kin: Fiona Welsh
Present Address: Palm Street, West Virginia
Permanent Address: Collin Street, New York
Phone Number1: 8237395357
Phone Number2: 39874983
Employee Service No: EDW2356
NIC NO: 463829
Social Security No: YW2397
EOBI No: 46422
Salary: 6345
Hourly Rate: 40
Bank Account number: 42659265892895
Bank Name: ICICI bank
Name: John F Smith
Age: 34
Father/Husband's Name: Tim Smith
Next of Kin: Teena Smith
Present Address: Grill Street, Hawaii
Permanent Address: Barack Street, Texas
Phone Number1: 23858935
Phone Number2: 84056867
Employee Service No: EDW1567
NIC NO: 87456
Social Security No: YW2298
EOBI No: 76533
Salary: 4321
Hourly Rate: 30
Bank Account number: 82375702454468
Bank Name: HDC bank
*/
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.