Question

C++ Lab 9A Inheritance Employee Class Create a project C2010Lab9a; add a source file Lab9a.cpp to...

C++
Lab 9A Inheritance

Employee Class

Create a project C2010Lab9a; add a source file Lab9a.cpp to the project. Copy and paste the code is listed below:

  1. Design a class named Employee. The class should keep the following information in member variables:
  • Employee name
  • Employee number
  • Hire date

// Specification file for the Employee class

#ifndef EMPLOYEE_H

#define EMPLOYEE_H

#include <string>

using namespace std;

class Employee

{

private:

       // Declare the Employee name string variable here.

// Declare the Employee number string variable here.

// Declare the hireDate string variable here.

      

public:

       // Default constructor

       Employee()

             { name = ""; number = ""; hireDate = ""; }

       // Define a Constructor that accepts, Name Number, and Hiredate

      

       // Mutators

       void setName(string n)

             { name = n; }

// define the setNumber(…) mutator here (See setName above as an example)

// define the setHireDate(…) mutator here

      

       // Accessors

       string getName() const

             { return name; }

       // define the getNumber() accessor here

// define the getHireDate() accessor here

};

#endif

  1. Write one or more constructors and the appropriate accessor and mutator functions for the class.

(Copy and paste your code and screen output here.)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#ifndef EMPLOYEE_H

#define EMPLOYEE_H

#include <string>
#include<iostream>

using namespace std;

class Employee

{

private:

string name; // Declare the Employee name string variable here.

string number;// Declare the Employee number string variable here.

string hireDate;// Declare the hireDate string variable here.

  

public:

// Default constructor

Employee()

{ name = ""; number = ""; hireDate = ""; }

// Define a Constructor that accepts, Name Number, and Hiredate
Employee(string n,string nm,string hd){
name=n;
number=nm;
hireDate=hd;
}
  

// Mutators

void setName(string n)

{ name = n; }

// define the setNumber(…) mutator here (See setName above as an example)

// define the setHireDate(…) mutator here

void setNumber(string s){
number=s;
}
string getNumber(){
return number;
}
void setHireDate(string h){
hireDate=h;
}
string getHireDate(){
return hireDate;
}

// Accessors

string getName() const

{ return name; }

// define the getNumber() accessor here

// define the getHireDate() accessor here

};
int main(){
Employee e("Uday","123","12/12/2018");
cout<<"Name : "<<e.getName()<<endl;
cout<<"Number : "<<e.getNumber()<<endl;
cout<<"Hiredate : "<<e.getHireDate()<<endl;
  
}
#endif

Add a comment
Know the answer?
Add Answer to:
C++ Lab 9A Inheritance Employee Class Create a project C2010Lab9a; add a source file Lab9a.cpp to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Lab 9B Inheritance Class Production Worker Create a project C2010Lab9b; add a source file Lab...

    C++ Lab 9B Inheritance Class Production Worker Create a project C2010Lab9b; add a source file Lab9b.cpp to the project. Copy and paste the code is listed below: 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) // Specification file for the ProductionWorker Class #ifndef PRODUCTION_WORKER_H #define PRODUCTION_WORKER_H #include "Employee.h" #include <string> using namespace std; class ProductionWorker...

  • // Client application class and service class Create a NetBeans project named StudentClient following the instructions...

    // Client application class and service class Create a NetBeans project named StudentClient following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. Add a class named Student to the StudentClient project following the instructions provided in the Starting a NetBeans Project instructions in the Programming Exercises/Projects Menu on Blackboard. After you have created your NetBeans Project your application class StudentC lient should contain the following executable code: package studentclient; public class...

  • Define a class named Employee . Derive this class from the class Person. An employee record...

    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...

  • java This lab is intended to give you practice creating a class with a constructor method,...

    java This lab is intended to give you practice creating a class with a constructor method, accessor methods, mutator methods, equals method , toString method and a equals method. In this lab you need to create two separate classes, one Student class and other Lab10 class. You need to define your instance variables, accessor methods, mutator methods, constructor, toString method and equals method in Student class. You need to create objects in Lab10 class which will have your main method...

  • Greetings, everybody I already started working in this program. I just need someone to help me...

    Greetings, everybody I already started working in this program. I just need someone to help me complete this part of the assignment (my program has 4 parts of code: main.cpp; Student.cpp; Student.h; StudentGrades.cpp; StudentGrades.h) Just Modify only the StudentGrades.h and StudentGrades.cpp files to correct all defect you will need to provide implementation for the copy constructor, assignment operator, and destructor for the StudentGrades class. Here are my files: (1) Main.cpp #include <iostream> #include <string> #include "StudentGrades.h" using namespace std; int...

  • J Inc. has a file with employee details. You are asked to write a C++ program...

    J Inc. has a file with employee details. You are asked to write a C++ program to read the file and display the results with appropriate formatting. Read from the file a person's name, SSN, and hourly wage, the number of hours worked in a week, and his or her status and store it in appropriate vector of obiects. For the output, you must display the person's name, SSN, wage, hours worked, straight time pay, overtime pay, employee status and...

  • In Java, Write a class encapsulating a restaurant,which inherits from Store. A restaurant has the following...

    In Java, Write a class encapsulating a restaurant,which inherits from Store. A restaurant has the following additional attributes: how many people are served every year and the average price per person. code the constructor, accessors, mutators, toString and equals method of the new subclass; also code a method returning the average taxes per year. You also need to include a client class to test your code for both the parent class and the subclass. Code for Store below(Super class aka...

  • Declare a Person class having two data members, Name of type string, and DOB (date of...

    Declare a Person class having two data members, Name of type string, and DOB (date of birth) of type Date. Assume that the Date class has already been written for you and you can use it by including the header file. Declare and define an appropriate constructor, and the functions setName, setDOB, getName and getDOB for this class. You need to write the complete code for declaring and defining this Person class with the given specifications.

  • It must be C++ Chapter 13 Programming Challenge 2: Employee Class. See instruction: Chapter 13 Programming...

    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...

  • JAVA help Create a class Individual, which has: Instance variables for name and phone number of...

    JAVA help Create a class Individual, which has: Instance variables for name and phone number of individual. Add required constructors, accessor, mutator, toString() , and equals method. Use array to implement a simple phone book , by making an array of objects that stores the name and corresponding phone number. The program should allow searching in phone book for a record based on name, and displaying the record if the record is found. An appropriate message should be displayed if...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT