Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hi everyone please I need help with this assignment, thanks Create an Employee c

ID: 3741983 • Letter: H

Question

Hi everyone please I need help with this assignment, thanks

Create an Employee class that includes three private data members— firstName (type string), lastName (type string), and monthlySalary (type int ).

It also includes several public member functions.

1. A constructor initializes the three data members.

2. A setFirstName function accepts a string parameter and does not return any data. It sets the firstName.

3. A getFirstName function does not accept any parameter and returns a string. It returns the firstName.

4. A setLastName function accepts a string parameter and does not return any data. It sets the lastName.

5. A getLastName function does not accept any parameter and returns a string. It returns the lastName.

6. A setMonthlySalary function accepts an integer parameter and does not return any data. It sets the monthlySalary. If the monthly salary is less than or equal zero, set it to 1000 and it displays the employee’s first name, last name and the inputted salary with a statement **==The salary is set to $1000.”

7. A getMonthlySalary function does not accept any parameter and returns an integer. It returns the monthlySalary.

8. An increaseMonthlySalary function accepts an integer parameter and does not return any data. It increases the monthlySalary by integer%. The increase could be positive or negative. When this function is called the salary adjusted employee’s name and salary information will be displayed (please see the following image for details).

This assignment comes with a CISP400V10AD1.zip file. It includes two files (CISP400V10AD1.cpp, and CISP400V10AD1.exe). The CISP400V10AD1.exe file is an executable file. You can double click the file to get to the expecting result of this assignment. The CISP400V10AD1.cpp is a driver program for you to use to test the implementation of this assignment. You need to create and finish coding the Employee.h(Employee class declaration) and Employee.cpp (the implementation of Employee class) based on the above specification.

Put the Employee.h, Employee.cpp and the CISP400V10AD1.cpp (attached) in a project, you can compile the project and run to the following result. Please be awarded that you can adjust only your program to generate the required result but not the code in CISP400V10AD1.cpp file.

Explanation / Answer

Implemented C++ Source code:-
=======================
#include<iostream>
#include<iomanip>
#include<string.h>
#include<stdlib.h>
#include<fstream>
int filesize=4;
using namespace std;
struct Employee_records
{
string Employee_id;
string FirstName;
string LastName;
int Monthly_salary;
};
struct Employee_records Records[100];
class Employee{
private:
string firstName;
string lastName;
int monthlySalary;
public:
Employee()
{
monthlySalary=1000;
}
public:
void setFirstName(string First_Name)
{
Records[filesize].FirstName=First_Name;
}
string getFirstName(int index)
{
return Records[index].FirstName;
}
void setLastName (string Last_Name)
{
Records[filesize].LastName=Last_Name;
}
string getLastName (int index)
{
return Records[index].LastName;
}
void setMonthlySalary (int salary)
{
Records[filesize].Monthly_salary=salary;
}
int getMonthlySalary (int index)
{
return Records[index].Monthly_salary;
}
void setemployeeid (string Id)
{
Records[filesize].Employee_id=Id;
}
string getEmployeeid(int index)
{
return Records[index].Employee_id;
}
public:
void PrintRecords()
{
cout<<" ****Employee Detail are:******"<<endl;
cout<<"-----------------------------------------------------------------------------"<<endl;
cout<<" Employee id"<<setw(10)<<"FirstName"<<setw(10)<<"LastName"<<setw(10)<<"Salary"<<endl;
cout<<"-----------------------------------------------------------------------------"<<endl;
for(int i=0;i<filesize;i++)
{
cout<<getEmployeeid(i)<<setw(17)
<<getFirstName(i)<<setw(10)
<<getLastName(i)<<setw(10)
<<getMonthlySalary(i)<<endl;
}
}
public:
int findEmployee(string Id)
{
for(int i=0;i<filesize;i++)
{
if(Id==getEmployeeid(i))
{
return 1;
}
}
return -1;
}
};
int main()
{
Employee obj;
ifstream inputfile;
string FirstName,LastName,Empid;
double salary;
int option,index;
inputfile.open("Empdata.txt",ios::in);
if(inputfile.is_open())
{
for(int i=0;i<filesize;i++)
{
inputfile>>Empid;
Records[i].Employee_id=Empid;
inputfile>>FirstName;
Records[i].FirstName=FirstName;
inputfile>>LastName;
Records[i].LastName=LastName;
inputfile>>salary;
Records[i].Monthly_salary=salary;
}
}
inputfile.close();
while(true)
{
cout<<" *** Menu ****"<<endl;
cout<<"1.Print Employee records "<<endl;
cout<<"2.Add New employee Records "<<endl;
cout<<"3.Find employee records "<<endl;
cout<<"4.Exit "<<endl;
cout<<" Please Select any option ";
cin>>option;
switch(option)
{
case 1:
obj.PrintRecords();
break;
case 2:
filesize=filesize+1;
cout<<" Please Enter New employee Id: ";
cin>>Empid;
obj.setemployeeid(Empid);
cout<<" Please enter FirstName: ";
cin>>FirstName;
obj.setFirstName(FirstName);
cout<<" Please enter LastName ";
cin>>LastName;
obj.setLastName(LastName);
cout<<" Please enter Monthly Salary ";
cin>>salary;
obj.setMonthlySalary(salary);
cout<<" New Employee details are added Successfully "<<endl;
cout<<" the New List of Employees are "<<endl;
obj.PrintRecords();
break;
case 3:
cout<<" Please enter the Empoyee id to search: ";
cin>>Empid;
index=obj.findEmployee(Empid);
if(index==-1)
cout<<" Employee details are not found "<<endl;
else
{
cout<<"-----------------------------------------------------------------------------"<<endl;
cout<<" Employee id"<<setw(10)<<"FirstName"<<setw(10)<<"LastName"<<setw(10)<<"Salary"<<endl;
cout<<"-----------------------------------------------------------------------------"<<endl;
cout<<obj.getEmployeeid(index)<<setw(17)
<<obj.getFirstName(index)<<setw(10)
<<obj.getLastName(index)<<setw(10)
<<obj.getMonthlySalary(index)<<endl;
}
break;
case 4:
exit(0);
default:
cout<<" !Invalid Option "<<endl;
}
}
return 0;
}


input file:-
=======
1234 venkana koothada 10000
9999 Prudhvi Kumar 20000
7777 Narayana Chekka 15000
5657 Subhani khan 56000

Sample Output:-
============
*** Menu ****
1.Print Employee records
2.Add New employee Records
3.Find employee records
4.Exit
Please Select any option 1
****Employee Detail are:******
-----------------------------------------------------------------------------
Employee id FirstName LastName Salary
-----------------------------------------------------------------------------
1234 venkana koothada 10000
9999 Prudhvi Kumar 20000
7777 Narayana Chekka 15000
5657 Subhani khan 56000
*** Menu ****
1.Print Employee records
2.Add New employee Records
3.Find employee records
4.Exit
Please Select any option 3
Please enter the Empoyee id to search: 5657
-----------------------------------------------------------------------------
Employee id FirstName LastName Salary
-----------------------------------------------------------------------------
9999 Prudhvi Kumar 20000
*** Menu ****
1.Print Employee records
2.Add New employee Records
3.Find employee records
4.Exit
Please Select any option 3
Please enter the Empoyee id to search: 3245
Employee details are not found
*** Menu ****
1.Print Employee records
2.Add New employee Records
3.Find employee records
4.Exit
Please Select any option 4
--------------------------------
Process exited after 23.14 seconds with return value 0
Press any key to continue . . .

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote