Question
Write the class definition for a class named Employee. The class should include data members for an employee object's name and salary (the salary will
Write the class definition for a class named Employee. The class should include data members for an employee object's name and salary (the salary will be an integer). The class should contain two member functions: the constructor and a function that allows a program to assign values to the data members. Add two member functions to the employee class. One member function should allow any program using an employee object to view the contents of the salary data member. The other member function should allow the program to view the contents of the employee name data member. (Hint: have the member functions simply return the contents of the appropriate data member).
Add another member function to the class. This function should calculate an employee object's new salary, based on a raise percentage, provided by the program (main function). Before calculating the raise, the member function should verify that the raise percentage is greater or equal to zero. If the raise percentage is less then zero, the member function should display an error message.
Write main function that will create an array of employee objects, assign values to the objects, display the names and current salaries for all objects, ask user for the raise percentage and then calculate and display new salaries for all objects.
There are a few answers for this question out there but they either do not use arrays, or they just don't work in visual studios 2017
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started