Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this assignment, implement and use the methods for a class called Employee.

ID: 3621894 • Letter: F

Question

For this assignment, implement and use the methods for a class called Employee.

The Employee class



Use the following class definition:



class Employee

{

public:

Employee( char [], int, double); //constructor



void printEmp();

void increaseSalary( double );



void setIDnum( int );

void setSalary( double );



int getIDnum();

double getSalary();



private:

char name[25];

int idNum;

double salary;

};



Data Members



The data members for the class are:



*



name this holds the employee's name

*



idNum this holds the employee's identification number

*



salary this holds the employee's salary



Constructor



The constructor for the class should initialize the data members using the passed in arguments. It takes 3 arguments: a character array with an employee name, an integer employee identification number, and a double that holds the employee salary. Use the setIDnum and setSalary methods to initialize the identification number and salary, respectively (this will help to guard against invalid initial values).

Methods

void printEmp()



This method displays the employee information. It takes no arguments and returns nothing. It should display the information as follows:



Employee: Barney Rubble ID: 24680 Salary: $ 1234.56



void increaseSalary( double inrementAmount )



This method increases an employee's salary. It takes one argument: a double that represents the amount to increase the employee's salary. It returns nothing.



If the passed in amount is less than or equal to 0, display an error message and do not make any changes to the employee's salary. If the passed in amount is greater than 0, use it to increment the employee's salary.

void setIDnum( int newIDnum )



This method changes an employee's identification number. It takes one argument: an integer that represents the new employee identification number. It returns nothing.



If the passed in identification number is less than 1000 or greater than 9999999, display an error message and do not make any changes to the employee's identification number. If the passed in identification number is between 1000 and 9999999, inclusive, update the employee's identification number.

void setSalary( double newSalary )



This method changes an employee's salary. It takes one argument: a double that represents the new employee salary. It returns nothing.



If the passed in salary is less than or equal to 0, display an error message and do not make any changes to the employee's salary. If the passed in salary is greater than 0, update the employee's salary.

int getIDnum()



This method returns an employee's identification number. It takes no arguments.

double getSalary()



This method returns an employee's salary. It takes no arguments.

main()



In main(), create 5 Employee objects. They should contain the values:



*



The first employee should have your name, your z-number (minus the z) for the identification number, and a salary of 113019.77

*



The second employee should have the name of your recitation TA, an identification number of 24680, and a salary of 1234.50

*



The third employee should have the name "Sam Axe", an identification number of 9393, and a salary of 82.12

*



The fourth employee should have the name "Michael Westen", an identification number of 91781, and a salary of 3869.00

*



The fifth employee should have the name "Fiona Glenanne", an identification number of 2007, and a salary of 71940.76



The rest of main() will include using the various methods on each of the 5 Employee objects. Display a label similar to "The first Employee object" before anything is outputted for each of the objects.



For the first employee, display the employee information, increase the employee's salary by 939.39, and display the employee information once again.



For the second employee, display the employee information, try to increase the employee's salary by a negative amount (the actual amount is up to you), and display the employee information once again.



For the third employee, display the employee's information, change the employee's identification number to 123456, change the employee's salary to 82000.12, and display the employee information once again.



For the fourth employee, display the employee's information, try to change the employee's identification number to 23, change the employee's salary to 321.98, display only the employee's salary, and display the employee information once again.



For the fifth employee, display the employee's information, try to change the employee's salary to a negative value (the actual amount is up to you), and display the employee information once again.

Explanation / Answer

please format the code and paste ill help you use komodo edit

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote