In: Computer Science
2020 $xx,xxx.xx
2021 $xx,xxx.xx
2022 $xx,xxx.xx
2023 $xx,xxx.xx
Test Data: 2020, 43897.00
Program is in c++.
Thanks for the question. Below is the code you will be needing. Let me know if you have any doubts or if you need anything to change.
If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.
Thank You!
===========================================================================
#include<iostream>
#include<iomanip>
using namespace std;
void calcNewSalary(double &sal, double
hike_percent){
sal = sal + sal*hike_percent/100;
}
int main(){
double curr_sal;
int year;
cout<<"Enter year: "; cin >> year;
cout<<"Enter current salary: "; cin >>
curr_sal;
double raise_percentage[] = {0, 6,5,4} ;
cout<<setprecision(2)<<showpoint<<fixed;
for(int i=0; i<4; i++){
calcNewSalary(curr_sal,raise_percentage[i]);
cout<<year++<<"
$"<<curr_sal<<endl;
}
return 0;
}