Programming challenge | Computer Science homework help

Exercise 2. Default, Default-Copy, and Argument Constructor

Employee Class (from Ch 13 Program Challenge 2)

Write a class named Employee that has the following member variables:
name. A string that holds the employee s name.
idNumber. 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.

Write appropriate mutator functions that store values in these member variables and accessor functions that return the values in these member variables. Once you have written the class, write a separate program that creates three Employee objects to hold the following data.

A 4-argument 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 2-argument 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.
A default Copy constructor that assigns previously created object instance to a new instance.
Use the attached lab3_app.cpp, to start this Exercise 2.
// Chapter 13, Programming Challenge 2: Employee Class
#include <iostream>
#include <string>
using namespace std;

// Define the Employee Class below:

// Function prototype
void displayEmployee(Employee);

// Driver program to demonstrate the class
int main()
{
// Create an Employee object to test constructor #1.
Employee susan(“Susan Meyers”, 47899, “Accounting”, “Vice President”);

// Create an Employee object to test constructor #2.
Employee mark(“Mark Jones”, 39119);
mark.setDepartment(“IT”);
mark.setPosition(“Programmer”);

// Create an Employee object to test constructor #3.
Employee joy;
joy.setName(“Joy Rogers”);
joy.setIdNumber(81774);
joy.setDepartment(“Manufacturing”);
joy.setPosition(“Engineer”);

// Display each employee’s data.
displayEmployee(susan);
displayEmployee(mark);
displayEmployee(joy);

return 0;
}

//**************************************************
// The displayEmployee function displays the data *
// in the Employee object passed as an argument. *
//**************************************************

void displayEmployee(Employee e)
{
cout << “Name: ” << e.getName() << endl;
cout << “ID Number: ” << e.getIdNumber() << endl;
cout << “Department: ” << e.getDepartment() << endl;
cout << “Position: ” << e.getPosition() << endl << endl;
}







Calculate Your Essay Price
(550 words)

Approximate price: $22

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more

Order your essay today and save 10% with the coupon code: best10