Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The only library functions you are allowed to use are: cmath, climits, cstdlib:

ID: 3604462 • Letter: T

Question

The only library functions you are allowed to use are: cmath, climits, cstdlib: all String: empty, length, conatenation, indexing/at, relational operators iostream: , >>, getline (with cin, cout, cerr) fsream: all of above, open, close, eof, fail 5, (24%) You are given a job offer with the following terms: Your starting pay (year 0) is s dollars. Your initial position level is1. You get promoted by 1 level every 2 years. In year k, you get a raise of 35(k)(k +1)(k+2)... (k +p) cents, where p is your position level. For example, p would become 2 in year 2, and you would get a raise of $8.80 = 35(2)(3)(4) cents in year 2. Write a function that computes your pay level in year y, using the following prototype: // Pre condition : y>=0 double pavfint v int K) l/double pay (int y, int s) C++ , No Array, No Vector, No Pointer

Explanation / Answer

#include <iostream>

using namespace std;


double pay(int s,int y)
{
int p = y/2 + 1; // level after y years

double raise = 35.0;

for(int i = 0;i <= p;i++)
{
raise *= (y+i);
}


return s + raise/100;
}


int main()
{
int s;
cout << "Enter the starting pay: ";
cin >> s;

int y;

cout << "Enter the number of years: ";
cin >> y;

cout << "Pay after " << y << " years is: $" << pay(s,y) << endl;

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote