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

Your lab will have 2 files: 1) facultyType.h and 2) a cpp file with the main pro

ID: 3700996 • Letter: Y

Question

Your lab will have 2 files: 1) facultyType.h and 2) a cpp file with the main program. You must write the faculty Type.h file. The code for the main program is below. Run the program in Visual Studio C++. The class faculty Type has private variables for first name, last name and department of a faculty member. Another variable holds the salary, and finally a variable gives the number of years of service. The functions that change data (modifyALL and changeSalary) will get user keyboard input for the new values. #include # include using namespace std; #include "facultyType.h" int mainO facultyType facl; facultyType fac2("Betty", "Thomas", "BIOL", 55750, 5); fac1.printO: fac2.printO; fac1.modifyALLO; fac2.changeSalary0: fac1 printO; fac2.print(O: system("pause"); return 0

Explanation / Answer

Please find the code below with detailed inline comments.

CODE

======================

#include <iostream>
#ifndef facultyType_H
#define facultyType_H

using namespace std;

class facultyType {
private:
string fname, lname, department;
float salary;
int years;
public:
facultyType() {
fname = "";
lname = "";
department= "";
salary = 0.0;
years = 0;
}
  
facultyType(string f, string l, string d, float sal, int y) {
fname = f;
lname = l;
department = d;
salary = sal;
years = y;
}
  
void modifyAll() {
cout << "First name: ";
cin >> fname;
  
cout << "Last name: ";
cin >> lname;
  
cout << "Department : ";
cin >> department;
  
cout << "Salary : $";
cin >> salary;
  
cout << "Years of experience: ";
cin >> years;
}
  
void changeSalary() {
cout << "Salary : $";
cin >> salary;
}
  
void print() {
cout << "The Faculty Details are : " << endl;
cout << "First name: " << fname
<< "Last name: " << lname
<< "Department: " << department
<< "Salary: $" << salary
<< "Years of experience: " << years;
}
};
#endif