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

Need help ASAP. C++ Language Please update the test case code below with the fol

ID: 3568659 • Letter: N

Question

Need help ASAP. C++ Language

Please update the test case code below with the following directions.

Here are the directions:

Write a class named Employee that has the following member variables:

   name       A string that holds the employee's name.  

dNumber   An int variable that holds the employee's ID number.  

department   A string that holds the name of the department where the employee works.  

position       A string that holds the employee's job title.

The class should have the following constructors:

A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee's name, employee's ID number, department, and position.

A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee's name and ID number. The department and position fields should be assigned an empty string ("").

A default constructor that assigns empty strings ("") to the name, department, and position member variables, and 0 to the idNumber member variable.
Write appropriate mutator functions that store values in these member variables and accessor functions that return the values in these member variables.

The class should have the following accessors and mutators:

Write a member to display these values:

Here are examples of the program output

Example input:

Program Output with the above inputs:

Example inputs:

Program Output with the above input:

Another example input:

Program output:

Please test the inputs above and your program output should look exactly like the outputs above.

Please post your program outputs.

Thank you very much!

Program Output
  Name: Susan Meyers  ID number: 47899  Department: Accounting  Title: Vice President  Employee: Susan Meyers (47899)          Vice President in department Accounting  Employee: Fritz (6)          Cat in department Cartoon  

Explanation / Answer

#include <iostream>
#include <string>
using namespace std;

class Employee
{
   private:
  
   string name;
   int dNumber;
   string department;
   string position;
  
   public:
   Employee()
   {
       name="";
       dNumber = 0;
       department = "";
       position = "";
   }
   Employee(string n, int id)
   {
       name=n;
       dNumber = id;
       department = "";
       position = "";
   }
   Employee(string n, int id, string d, string p)
   {
       name=n;
       dNumber = id;
       department = d;
       position = p;
   }
  
   string getname()
   {
       return name;
   }
int getdNumber()
{
   return dNumber;
}
string getdepartment()
{
   return department;
}
string getposition()
{
   return position;
}
void setname(string n)
{
   name = n;
}
void setdNumber(int dN)
{
   dNumber = dN;
}
void setdepartment(string d)
{
   department = d;
}
void setposition(string p)
{
   position = p;
}
void display()
{
   cout<<"Employee: "<<name<<"("<<dNumber<<") ";
   cout<<" "<<position<<" in "<<department<<" ";
}
};

int main() {
int choice, dN;
string n, d, p;
Employee employee;

cin >> choice;
cin.ignore();
if (choice == 1) {
getline(cin, n);
cin >> dN;
cin.ignore();
getline(cin, d);
getline(cin, p);

Employee employee1(n, dN, d, p);
employee = employee1;
} else if (choice == 2) {
getline(cin, n);
cin >> dN;
cin.ignore();

Employee employee2(n, dN);
employee = employee2;
}
cout << "Name: " << employee.getname() << endl;
cout << "ID number: " << employee.getdNumber() << endl;
cout << "Department: " << employee.getdepartment() << endl;
cout << "Title: " << employee.getposition() << endl;
employee.display();

getline(cin, n);
cin >> dN;
cin.ignore();
getline(cin, d);
getline(cin, p);
employee.setname(n);
employee.setdNumber(dN);
employee.setdepartment(d);
employee.setposition(p);

employee.display();
}

- ------ ------ ------ ------ ------ ------ -----

OUTPUT

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