Question
4. Create simple program that gives an employee a 5% raise and changes their salary. This is a simple program and could all be done
4.
Create simple program that gives an employee a 5% raise and changes their salary.
This is a simple program and could all be done in main. However, we want to see how toorganize a program using a function and a library so add the function declaration and the function implementation in the library as explained.
In Questions 5-7, you will be writing the code that would go in the following files.
- raise.cpp
- raise.h
- main.cpp.
For this question we will work in raise.h.
To Do:
- Write function declaration for a function calledAddRaise.
This function acceptsone float parameter passed by reference.
- current salary
The function is avoid function.
This declaration would go in the file raise.h. You can assume the following code is already in raise.h. You will need to add the code listed above.
#ifndef RAISE_H
#defineRAISE_H
#endif
5.
For this question we will write the implementation of theAddRaise function.
To Do:
- Write implementation for the function AddRaise. This function is to compute the new salary with a 5% raise. It is to update the salary sent to this new value.
The formula for computing a 5% raise is:
salary * 1.05
This function acceptsone float parameter passed by reference.
- current salary
The function is avoid function.
This implementation would go in the file raise.cpp. You can assume the following code is already in raise.cpp. You will need to add the code listed above.
#include
#include"raise.h"
6.
For this question we will using the AddRaise function.
To Do:
- Define any variables needed
- Ask the user for their monthly salary and get the value
- Call the AddRaise function
- Print out the user's new salary
This code would go in the file main.cpp. You can assume the following code is already in main.cpp. You will need to add the code listed above.
#include
#include"library.h"
using namespace std;
int main() {
return 0;
}
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