It must be C++
Chapter 13 Programming Challenge 2: Employee Class.
See instruction: Chapter 13 Programming Challenge 2 Employee Class.pdf
Program Template:
// Chapter 13, Programming Challenge 2: Employee Class
#include <iostream>
#include <string>
using namespace std;
// Employee Class Declaration
class Employee
{
private:
string name; // Employee's name
int idNumber; // ID number
string department; // Department name
string position; // Employee's position
public:
// TODO: Constructors
// TODO: Accessors
// TODO: Mutators
};
// Constructor #1
Employee::Employee(string n, int i, string d, string p)
{
// TODO
}
// Constructor #2
Employee::Employee(string n, int i)
{
// TODO
}
// Constructor #3, default constructor
Employee::Employee()
{
// TODO
}
// Function prototype
void displayEmployee(Employee);
// Driver program to demonstrate the class
int main()
{
// TODO: Create an Employee object to test constructor obj
#1.
// TODO: Create an Employee object to test constructor obj #2.
// TODO: Create an Employee object to test constructor obj
#3.
// Display each employee's data.
displayEmployee(/** TODO: obj #1 */);
displayEmployee(/** TODO: obj #2 */);
displayEmployee(/** TODO: obj #2 */);
return 0;
}
//**************************************************
// The displayEmployee function displays the data *
// in the Employee object passed as an argument. *
//**************************************************
void displayEmployee(Employee e)
{
// TODO
}
#include <iostream>
using namespace std;
#include <iomanip>
#include <string>
using namespace std;
// Employee Class Declaration
class Employee
{
private:
string name; // Employee's name
int idNumber; // ID number
string department; // Department name
string position; // Employee's position
public:
Employee(string n, int i, string d, string p);
Employee();
Employee(string n, int i);
// TODO: Constructors
// TODO: Accessors
// TODO: Mutators
string getdepartment(){
return department;
}
string getname(){
return name;
}
int getidNumber(){
return idNumber;
}
string getposition(){
return position;
}
void setdepartment(string d){
department = d;
}
void setposition(string d){
position = d;
}
void setname(string d){
name = d;
}
void setidNumber(int d){
idNumber = d;
}
};
// Constructor #1
Employee::Employee(string n, int i, string d, string p)
{
name = n;
idNumber = i;
department = d;
position = p;
// TODO
}
// Constructor #2
Employee::Employee(string n, int i)
{
// TODO
name = n;
idNumber = i;
}
// Constructor #3, default constructor
Employee::Employee()
{
name = "";
idNumber = 0;
department = "";
position = "";
// TODO
}
// Function prototype
void displayEmployee(Employee);
// Driver program to demonstrate the class
int main()
{
// TODO: Create an Employee object to test constructor obj #1.
// TODO: Create an Employee object to test constructor obj
#2.
// TODO: Create an Employee object to test constructor obj #3.
Employee e1("Susan Mayers",47899,"Accounting","Vice
President");
Employee e2("Mark Jones",39119,"IT","Programmer");
Employee e3("Joy Rogers",81774,"Manufacturing","Engineer");
// Display each employee's data.
cout<<setw(10)<<" Name IdNumber Department
Position"<<endl;
cout<<endl;
Employee e4;
Employee e5("Rahul Kundra",81774);
displayEmployee(e1);
displayEmployee(e2);
displayEmployee(e3);
displayEmployee(e4);
displayEmployee(e5);
return 0;
}
//**************************************************
// The displayEmployee function displays the data *
// in the Employee object passed as an argument. *
//**************************************************
void displayEmployee(Employee e)
{
cout<<setw(20)<<e.getname()<<setw(20)<<e.getidNumber()<<setw(20)<<e.getdepartment()<<"
"<<setw(20)<<e.getposition()<<endl;
// TODO
}
========================
See Output
Thanks, let me know if there is any concern.
It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming...
Using C++, 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. 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,...
Write a C++ program Write a class named Employee that has the following member variables: name A string that holds the employee name idNumber An int to hold employee id number department A string to hold the name of the department position A string to hold the job position 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...
Create a c++ code and answer number 1 Homework Ch. 13 - Employee Class 30 points Design a class named Employee that has the following attributes: * Name ID Number- (Employee's] Identification Number " Department-the name of the department where the employee works " Position-the employee's job title The class should have the following constructors: A constructor that accepts values for all the member data as arguments A constructor that accepts the following values as arguments and assigns them to...
Create a C# Console program. Add a class named Employee that has the following public fields: • Name. The name field references a String object that holds the employee’s name. • IDNumber. The IDNumber is an int that holds the employee’s ID number. • Department. The department field is a String that holds the name of the department where the employee works. • Position. The position field is a String that holds the employee’s job title. Once you have written...
Given attached you will find a file from Programming Challenge 5 of chapter 6 with required you to write a Payroll class that calculates an employee’s payroll. Write exception classes for the following error conditions: An empty string is given for the employee’s name. An invalid value is given to the employee’s ID number. If you implemented this field as a string, then an empty string could be invalid. If you implemented this field as a numeric variable, then a...
1) Introduction to Objects (with Constructors and Properties) We need to answer the question which are below. and instruction are given down starting with part(b). Just we need to copy paste code file and follow the instruction and answer related to them. a) Enter the following program.Answer The questions below the codes, Notice that it consists of two classes that will go into the same project. Please put each class into its own code file (use Lab5_1 for the Project...
IN JAVADesign a Payroll class with the following fields:• name: a String containing the employee's name• idNumber: an int representing the employee's ID number• rate: a double containing the employee's hourly pay rate• hours: an int representing the number of hours this employee has workedThe class should also have the following methods:• Constructor: takes the employee's name and ID number as arguments• Accessors: allow access to all of the fields of the Payroll class• Mutators: let the user assign values...
c++ Part 1 Consider using the following Card class as a base class to implement a hierarchy of related classes: class Card { public: Card(); Card (string n) ; virtual bool is_expired() const; virtual void print () const; private: string name; Card:: Card() name = ""; Card: :Card (string n) { name = n; Card::is_expired() return false; } Write definitions for each of the following derived classes. Derived Class Data IDcard ID number CallingCard Card number, PIN Driverlicense Expiration date...
WRITE IN C++ ONLY PLEASE. IM USING VISUAL STUDIO CODE.1. Employee and ProductionWorker ClassesDesign a class named Employee. The class should keep the following information in• Employee name• Employee number• Hire dateWrite one or more constructors and the appropriate accessor and mutator functions for the class.Next, write a class named ProductionWorker that is derived from the Employee class. The ProductionWorker class should have member variables to hold the following information:• Shift (an integer)• Hourly pay rate (a double )The workday...
Define a class named Employee . Derive this class from the class Person. An employee record inherits an employee's name from the class Person. In addition, an employee record contains an annual salary (represented by a single value of type double), a hire date that gives the year hired (as a single value of type int), an identification number of type int, and a department of type String. Give your class a reasonable complement of constructors, accessors, mutators, an equals...