Question

4. For the Employee Class shown below i. Add to the model an Adapter Class, EmployeeC, that can be used to convert employee IDs that are character based to work with Employee. i. Provide the pseudocode for the getEmployeelD operator for the EmployeeC classs Employee EMPLOYEE_ID:int +getEmployeelD():int

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

please go threw this code it is working according to you assignment.

#include <iostream>
using namespace std;

class Employee //parent class
{
public:
int EMPLOYEE_ID;
int getEmployeeID(void) //get id
{
return EMPLOYEE_ID;
}
};
class Adapter:public Employee //inherit Employee to Adapter
{


};

class EmployeeC : public Employee //inherit Employee to Adapter
{
public:
EmployeeC(char id) //perameterised construcore
{
EMPLOYEE_ID = id; //assign id to Empoyee class perameter
}
};

int main()
{
int id;
EmployeeC employee(5); //Adapter object
id = employee.getEmployeeID(); //call function of Employee class
cout << "Employee id - " << id << endl;
}

chaitanya@chaitanya-SVE1513BYNB:~/workspace/practice/HomeworkLib/fileoperation En 4)6:49 AM chaitanya@chaitanya-SVE 1513BYNB:~/work

Add a comment
Know the answer?
Add Answer to:
4. For the Employee Class shown below i. Add to the model an Adapter Class, EmployeeC,...
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
  • 4. Create a Business class. This class should store an array of Employee objects. Add a...

    4. Create a Business class. This class should store an array of Employee objects. Add a method to add employees to the Business, similar to addFoodItem in the Meal class. Add two more methods for the Business class: getHighestPaid(), which returns the Employee who has been paid the most in total, and getHighestTaxed(), which returns the Employee who has been taxed the most in total. Note: you do not need to handle the case of ties. These are all the...

  • In the Employee class, add an implementation for the calculatePension() method declared in the interface. Calculate...

    In the Employee class, add an implementation for the calculatePension() method declared in the interface. Calculate the pension to date as the equivalent of a monthly salary for every year in service. 4) Print the calculated pension for all employees. ************** I added the interface and I implemented the interface with Employee class but, I don't know how can i call the method in main class ************ import java.io.*; public class ManagerTest { public static void main(String[] args) { InputStreamReader...

  • c++ please need help with this question Consider a class Employee with data members: age(an integer),...

    c++ please need help with this question Consider a class Employee with data members: age(an integer), id (an integer) and salary (a float), and their corresponding member functions as follows: class Employee {        private:             int age;             int id;             float salary;        public:             Employee( ); // default constructor: age=0, id=0, and salary=0             Employee(Employee &x);   // copy constructor           Employee& operator = (Employee &x); // equal sign operator             void setAge(int x);    // let age = x...

  • DIRECTIONS FOR THE WHOLE PROJECT BELOW BigInt class The purpose of the BigInt class is to...

    DIRECTIONS FOR THE WHOLE PROJECT BELOW BigInt class The purpose of the BigInt class is to solve the problem using short methods that work together to solve the operations of add, subtract multiply and divide.   A constructor can call a method called setSignAndRemoveItIfItIsThere(). It receives the string that was sent to the constructor and sets a boolean variable positive to true or false and then returns a string without the sign that can then be processed by the constructor to...

  • In this lab, you use the pseudocode in figure below to add code to a partially...

    In this lab, you use the pseudocode in figure below to add code to a partially created Python program. When completed, college admissions officers should be able to use the Python program to determine whether to accept or reject a student, based on his or her class rank. Summary In this lab, you use the pseudocode in figure below to add code to a partially created Python program. When completed, college admissions officers should be able to use the Python...

  • IN C++ Create a class to act as a generic array (i.e. the user will be...

    IN C++ Create a class to act as a generic array (i.e. the user will be able to choose the data type to be stored by passing the appropriate template argument. Integer template arguments will also be used to set the upper and lower bounds of the array. Provide all necessary functionality to allow the class to act as an array ([] operator, = operator etc.). The array does not need to provide input or output methods to act on...

  • I have written my code for an employee management system that stores Employee class objects into...

    I have written my code for an employee management system that stores Employee class objects into a vector, I am getting no errors until I try and compile, I am getting the error: C2679 binary '==': no operator found which takes a right-hand operand of type 'const std::string' (or there is no acceptable conversion). But I am not sure why any help would be great, Thank you! 1 2 3 4 5 6 7 8 9 10 11 12 13...

  • Write a Java class named Employee to meet the requirements described in the UML Class Diagram...

    Write a Java class named Employee to meet the requirements described in the UML Class Diagram below: Note: Code added in the toString cell are not usually included in a regular UML class diagram. This was added so you can understand what I expect from you. If your code compiles cleanly, is defined correctly and functions exactly as required, the expected output of your program will solve the following problem: “An IT company with four departments and a staff strength...

  • How do I add the space that this Zybooks code keeps asking me to add? 5.13...

    How do I add the space that this Zybooks code keeps asking me to add? 5.13 LAB: Output numbers in reverse Write a program that reads a list of integers, and outputs those integers in reverse. The input begins with an integer indicating the number of integers that follow. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5...

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
Active Questions
ADVERTISEMENT