Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

Explain the purposes served by the jobsite office.

Answered: 1 week ago