Menu

[Solved]Write Class Named Employee Following Member Variables Name String Holds Employee Name Idnu Q37180837

Write a class named Employee that has the following membervariables:

  • name A string that holds the employeename
  • idNumber An int to hold employee idnumber
  • department A string to hold the name of thedepartment
  • position A string to hold the jobposition

The class will have three constructors:

1. A constructor that accepts all the internal data such as:

Employee susan(“Susan Meyers”, 47899,”Accounting”, “Vice President”);

2. A constructor that accepts some of the information andassigns an empty string to the missing data such as:

Employee mark(“Mark Jones”,39119);

Then the missing data will be filled in by mutator memberfunctions.

3. A constructor that accepts no information ( the defaultconstructor ) such as:

      Employee joy;

Then the missing data will be filled in by mutator memberfunctions.

Write the appropriate mutator and accessor functions for all thedata of the Employee class. See below for the names to use forthese functions. Examples would be setPosition and getPositionetc…

Write a member function of the Employee class to display all theinformation in the class called displayEmployee

Then use the following driver program to test your class:

// Driver program to demonstrate theclass

int main()

{

   // Create an Employeeobject to test constructor #1.

   Employee susan(“SusanMeyers”, 47899, “Accounting”, “Vice President”);

  

   // Create an Employeeobject to test constructor #2.

   Employee mark(“MarkJones”, 39119);

  mark.setDepartment(“IT”);

  mark.setPosition(“Programmer”);

   // Create an Employeeobject to test constructor #3.

   Employee joy;

   joy.setName(“JoyRogers”);

  joy.setIdNumber(81774);

  joy.setDepartment(“Manufacturing”);

  joy.setPosition(“Engineer”);

  

   // Display eachemployee’s data.

  displayEmployee(susan);

  displayEmployee(mark);

   displayEmployee(joy);

   system(“pause”);

   return 0;

}//end main

Sample output:

Name: Susan Meyers

ID Number: 47899

Department: Accounting

Position: Vice President

Name: Mark Jones

ID Number: 39119

Department: IT

Position: Programmer

Name: Joy Rogers

ID Number: 81774

Department: Manufacturing

Position: Engineer

Press any key to continue . . .

Expert Answer


Answer to Write a class named Employee that has the following member variables: name A string that holds the employee name idNumbe… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *