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

Please help and indicate where what was done where? Please write in c++ language

ID: 3831010 • Letter: P

Question

Please help and indicate where what was done where? Please write in c++ language using no global variables 4. A small university has no more than 250 faculty members. A class called faculty Type stores faculty data including first name, last name, department, salary, and number of years of service. The university uses a C++ main() program which stores faculty data in an array of facultyType objects called Faculty. The university is able to perform the following actions: Add a new faculty member Increase all faculty members salary by a designated percent Output faculty information for all faculty who have more than 15 years of service Functions in main() are used to perform these actions 4.a. Write the class definition of the class facultyType. It will have the usual print and setAll functions; add other set and get functions as needed. 4.b. Write the function definitions of the facultyType class functions. 4 c. Choose one of the main( program functions in the bulleted list above, and write it. (For the first bullet, assume that one of the parameters of your function is the index in the Faculty array where the new one is to be added). Indicate the function you choose here:

Explanation / Answer

The complete program is given below:

#include<iostream>
#include<string.h>
using namespace std;
class facultyType //defining class
{
public:
string fname,lname,dept;
int yr;
float sal;
};
void addfaculty(facultyType a[],int len);
void increasesal(facultyType a[],int len);
void display(facultyType a[],int len);
void addfaculty(facultyType a[],int len)// function to add faculty
{
facultyType a1;
cout<<"Enter the details of the faculty: ";
cout<<"Enter first name:";
cin>>a1.fname;
cout<<"Enter last name:";
cin>>a1.lname;
cout<<"Enter salary:";
cin>>a1.sal;
cout<<"Enter years in service:";
cin>>a1.yr;
a[len]=a1;
}
void increasesal(facultyType a[],int len)//function to increase salary by a specified percentage
{
int i;
float p;
cout<<"Enter percentage of salary to be increases:";
cin>>p;
for(i=0;i<len;i++)
a[i].sal*=(1+p/100);
}
void display(facultyType a[],int len)//function to display details of all members with more than 15 years experience
{
int i;
for(i=0;i<len;i++)
{
if(a[i].yr<=15)
continue;
cout<<a[i].fname<<" "<<a[i].lname<<" "<<a[i].sal<<" "<<a[i].yr<<endl;
}
}
main()
{
facultyType a[100];
int len=0,c;
char x;
do
{
cout<<"Enter a choice:"<<endl;
cout<<"1.Add faculty."<<endl;
cout<<"2.Increase salary."<<endl;
cout<<"3.Display faculty with experience more than 15 years."<<endl;
cin>>c;
switch(c)
{
case 1:
addfaculty(a,len);
len++;
break;
case 2:
increasesal(a,len);
break;
case 3:
display(a,len);
}
cout<<"Do you want to continue?(Y/N)";
cin>>x;
}while(x!='N' && x!='n');
}