Question

In: Computer Science

/ READ BEFORE YOU START: // You are given a partially completed program which consist of...

/ READ BEFORE YOU START:
// You are given a partially completed program which consist of a class 'Employee' defined in employee.h
// The definitions of class member functions are to be filled in employee.cpp (this file).
// You should start completing the program from from Q1. Question numbers are given around line 24.
// To begin, you should trace through the given code and understand how it works.
// Please read the instructions above each required function and follow the directions carefully.
// If you modify any of the given code, the return types, or the parameters, you risk getting compile error.

// ***** WRITE COMMENTS FOR IMPORANT STEPS OF YOUR CODE. *****
// ***** GIVE MEANINGFUL NAMES TO VARIABLES. *****

#include "employee.h"
#include <iostream>
#include <string.h>

using namespace std;

// Q1 Employee (2 points)
// Employee() constructor assigns the following default values to class data members
// name: John Doe
// ID: 0
// roomNumber: 101
// supervisorName: Jane Doe
Employee::Employee()
{
   // enter code here
  
}

// Q2 (18 points)
// 2 points for each function

// Define all the class member functions.
// While defining member functions, note that these functions will be called using
// a 'Employee' object which will represent one employee.
// Eg- Employee e[10]; creates 10 Employee objects
//       e[2].setRoomNumber(202); will set 3rd employee's room number to 202.

// setName assigns 'name_input' to class data member 'name'
void Employee::setName(string name_input) {
   // enter code here

}

// setID assigns id_input to class data member 'ID'
void Employee::setID(int id_input) {
   // enter code here
  
}

// setRoomNumber assigns roomNumber_input to class data member 'roomNumber'
void Employee::setRoomNumber(int roomNumber_input) {
   // enter code here

}

// setSupervisor assigns supervisorName_input to class data member 'supervisorName'
void Employee::setSupervisorName(string supervisorName_input) {
   // enter code here
  
}

// displayEmployee displays the name, ID, room number and supervisor of the employee
// See expected output in question file.
void Employee::displayEmployee() {
   // enter code here
  
}

// getName returns the class data member 'name'.
string Employee::getName() {
   // enter code here
  
}

// getID returns the class data member 'ID'.
int Employee::getID() {
   // enter code here
  
}

// getRoomNumber returns the class data member 'roomNumber'.
int Employee::getRoomNumber() {
   // enter code here
  
}

// getSupervisorName returns the class data member 'supervisorName'.
string Employee::getSupervisorName() {
   // enter code here
  
}

Here is the employee.h code:

#include <string>
using namespace std;

class Employee {
private:
   string name;
   int ID, roomNumber;
   string supervisorName;

public:
   Employee();       // constructor

   void setName(string name_input);
   void setID(int id_input);
   void setRoomNumber(int roomNumber_input);
   void setSupervisorName(string supervisorName_input);
   void displayEmployee();
   string getName();
   int getID();
   int getRoomNumber();
   string getSupervisorName();
};

Please include the images of your output that go along with the code

It is C++ language

Solutions

Expert Solution

Here the the code after filling the blank places in the code according to the instructions -

To run the program, you need a main() function, so I've added a main() function in the program. so that you can see this program runnning in the wild.(i mean...giving output).

#include "employee.h"
#include <iostream>
#include <string.h>

using namespace std;

// Q1 Employee (2 points)
// Employee() constructor assigns the following default values to class data members
// name: John Doe
// ID: 0
// roomNumber: 101
// supervisorName: Jane Doe
Employee::Employee()
{
   name= "John Doe";
   ID = 0;
   roomNumber = 101;
   supervisorName = "Jane Doe";
  
}

// Q2 (18 points)
// 2 points for each function

// Define all the class member functions.
// While defining member functions, note that these functions will be called using
// a 'Employee' object which will represent one employee.
// Eg- Employee e[10]; creates 10 Employee objects
//       e[2].setRoomNumber(202); will set 3rd employee's room number to 202.

// setName assigns 'name_input' to class data member 'name'
void Employee::setName(string name_input) {
   // enter code here
   name = name_input;

}

// setID assigns id_input to class data member 'ID'
void Employee::setID(int id_input) {
   // enter code here
   ID = id_input;
  
}

// setRoomNumber assigns roomNumber_input to class data member 'roomNumber'
void Employee::setRoomNumber(int roomNumber_input) {
   // enter code here
   roomNumber = roomNumber_input;

}

// setSupervisor assigns supervisorName_input to class data member 'supervisorName'
void Employee::setSupervisorName(string supervisorName_input) {
   // enter code here
   supervisorName = supervisorName_input;
  
}

// displayEmployee displays the name, ID, room number and supervisor of the employee
// See expected output in question file.
void Employee::displayEmployee() {
   // enter code here
   cout<<"\nName: "<<name;
   cout<<"\nID: "<<ID;
   cout<<"\nroomNumber: "<<roomNumber;
   cout<<"\nSupervisor Name: "<<supervisorName;
  
}

// getName returns the class data member 'name'.
string Employee::getName() {
   // enter code here
   return name;
  
}

// getID returns the class data member 'ID'.
int Employee::getID() {
   // enter code here
   return ID;
  
}

// getRoomNumber returns the class data member 'roomNumber'.
int Employee::getRoomNumber() {
   // enter code here
  return roomNumber;
}

// getSupervisorName returns the class data member 'supervisorName'.
string Employee::getSupervisorName() {
   // enter code here
   return supervisorName;
  
}


int main(){
    //create a new employee.
    Employee e;
    
    cout<<"Our new employee created.\n-----------------";
    e.displayEmployee();
    
    cout<<"\n\nChanging the Name,ID,room Number,supervisor Name of employee.\n";
    e.setName("Nikhil Nagar"); 
    e.setID(109);
    e.setRoomNumber(987);
    e.setSupervisorName("Mark Juckerberg");
    
    cout<<"\n\nDisplay employee after changes \n-------------------- ";
    e.displayEmployee();
}


OUTPUT of the Program:

Hope it helps!

Thumbsup;)


Related Solutions

BEFORE YOU START: Before working on this assignment you should have completed Assignment 1. PROGRAM STATEMENT...
BEFORE YOU START: Before working on this assignment you should have completed Assignment 1. PROGRAM STATEMENT AND REQUIREMENTS: You will implement in Java the WIFI troubleshooting program you created in Assignment 1 with the following additional conditions: At the end of the program, you will ask if the client wants to purchase a regular router for $50 or a super high-speed router for $200, adding the cost to the total amount the client needs to pay. Once your program calculates...
​ Before you start to type an answer, read the articles provided and think about all...
​ Before you start to type an answer, read the articles provided and think about all of things you have heard and read since the recent tax reform legislation. You will be awarded points for grammar, punctuation, spelling, and overall neatness. In your response, you must reference at least one of the articles provided. Here are the links to the articles: https://www.journalofaccountancy.com/news/2017/dec/tax-reform-bill-changes-for-individuals-201718070.html https://www.journalofaccountancy.com/news/2017/dec/congress-passes-tax-reform-201718091.html https://www.journalofaccountancy.com/news/2017/dec/president-signs-tax-cuts-jobs-act-201718112.html https://tax.thomsonreuters.com/checkpoint/individual-tax-changes-tax-reform-2017/?utm_campaign=SR.TR.INDIV.EL_1217&utm_medium=email&utm_source=Eloqua&site_id=82769734&elqTrackId=48423f0738ac41938fd5563259cb2922&elq=9cd800d5c2604b50b31a0405eb6373eb&elqaid=16613&elqat=1&elqCampaignId=12437 You are not required to give specific details about your financial situation, but please ask...
Assignment: Operations Make sure you have completed the Learning Activity in this unit before you start...
Assignment: Operations Make sure you have completed the Learning Activity in this unit before you start this Assignment. Using the graphic below, please discuss the inputs, processes, and outputs that pertain to your operations of the business you chose, whether it is a service or a product oriented business. Using these three steps as a reference, how will you satisfy your customers? What core competencies will you have that will set you apart from your competitors? Pick at least two...
Write a Fraction Class in C++ PLEASE READ THE ASSINGMENT CAREFULY BEFORE YOU START, AND PLEASE,...
Write a Fraction Class in C++ PLEASE READ THE ASSINGMENT CAREFULY BEFORE YOU START, AND PLEASE, DON'T ANSWER IT IF YOU'RE NOT SURE WHAT YOU'RE DOING. I APPRECIATE IF YOU WRITE COMMENTS AS WELL. WRONG ANSWER WILL GET A DOWNVOTE Thank in Advance. Must do; The class must have 3 types of constructors; default, overloaded with initializer list, copy constructor You must overload the assignment operator You must declare the overloaded output operator as a friend rather than part of...
Summary In this lab, you add the input and output statements to a partially completed Java...
Summary In this lab, you add the input and output statements to a partially completed Java program. When completed, the user should be able to enter a year, a month, and a day to determine if the date is valid. Valid years are those that are greater than 0, valid months include the values 1 through 12, and valid days include the values 1 through 31. Instructions Notice that variables have been declared for you. Write the simulated housekeeping() method...
Please Read Carefully Before start answering this question. Please follow the instructions. This Question is from...
Please Read Carefully Before start answering this question. Please follow the instructions. This Question is from 'BSBFIM501 Manage budgets and financial plans' course. There are no parts missing for this Question; guaranteed!. This is the original Screenshot direct from the question. Therefore, there are nothing any further information can be provided. Thanks for your understanding and Cooperation. Please answer the following questions from the topics discussed for Prepare, implement, monitor and modify contingency plans: 1.a. Explain the process of preparing...
Suppose that you have a program that can read through all posts within a given time...
Suppose that you have a program that can read through all posts within a given time period (e.g. the last 7 days) on a social network web site (e.g., Facebook), and generate a list of pairs (ui, pi) representing texts in all posts found, where i=1, 2, ..., and ui and pi represent the author username and the text content of the i-th post found, respectively. Describe an algorithm that outputs the list of usernames in the decreasing order of...
1) Please find the partially completed multiple regression analysis below, which explores the relationship between the...
1) Please find the partially completed multiple regression analysis below, which explores the relationship between the sales (in hundreds) and the independent variables price(in dollars), promotional expenditure(in hundreds of dollars) and the quality score ( 0-100) for a very popular Christmas season toy. The regression equation is Sales = 343.2 - 0.23* Price + 2.7* Promotional exp + 0.22* Quality Predictor Coef Standard Error/ SE Coef    VIF Constant 343.20 / 62.59 / 0 Price -0.23358 / 0.0373 / 2.415...
In each case write the chemical equation which describes the relevant acid-base reaction before you start...
In each case write the chemical equation which describes the relevant acid-base reaction before you start the mathematics. What are the exact pHs of: A. 10^-2 M acetic acid B. 5 x 10 -2 M sodium acetate C. 10^-3 M pyridinium chloride Please show the steps so I can understand how to do it.
Suppose you are given the following partially complete table for the coming month. You have a...
Suppose you are given the following partially complete table for the coming month. You have a meeting with the chief financial officer in fifteen minutes and he is expecting this information in its entirety. Note: all labor units are paid equally and labor is the firm’s only variable input.                  a) Labor Q Fixed Cost Variable Cost Total Cost 0 0 $0 1 5,500 2 8,500 3 9,000 4 9,200 $1,000 5 9,000 $1,250          b) Suppose the marginal resource...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT