Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your program must include the following as comments at the beginning of the program: name student number assignment information program documentation This assignment will give

Your program must include the following as comments at the beginning of the program:

name

student number

assignment information

program documentation

This assignment will give you practice defining and using a class in a program.

Create a class named Employee that includes the following:

3 private data members:

first name (type string)

last name (type string)

monthly salary (type double)

The class should have one constructor with 3 default parameters. The constructor initializes the three data members when an object is created. The default value for first name and last name is "unknown". The default value for the monthly salary is 0.00.

You must validate the data member monthly salary. If the value provided for monthly salary is not positive (greater than zero) set the value to 0.00. Do your validation in the setMonthlySalary() function. Your constructor should call the setMonthlySalary function to validate monthly salary.

Provide get and set member functions for the 3 data members (for example: getFirstName(), setLastName(), getMonthlySalary(), etc. )

Provide a member function to display the state of an employee object. Call this function displayEmployee(). The displayEmployee() function should not directly access the data members. Instead, it should use the get member functions to retrieve these values.

The output from function displayEmployee() functiion should be formatted as shown below: (without the bullet points... )

First name :

Last name :

Monthly Salary :

All of the member functions should have public access.

The class declaration must be stored in the header file employee.h

The definition of the class member functions must be in the file employee.cpp

Create a test program ( assign03.cpp ) that demonstrates class Employee's capabilities. Your program should demonstrate objects being created. Objects being modified using the set methods. Information displayed using get member functions and also the displayEmployee() member function. For one of your objects, try changing the monthly salary to a negative number and then display the value of the monthly salary to show the validation worked correctly.

When you have completed the assignment, create a ZIP file that includes the following:

Employee class declaration (employee.h)

Employee class source file (employee.cpp)

Your program source file (assign_03.cpp)

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_2

Step: 3

blur-text-image_3

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

create a database called auto _ parts _ unlimited

Answered: 1 week ago

Question

Distinguish between hearing and listening.

Answered: 1 week ago

Question

Use your voice effectively.

Answered: 1 week ago