Effective January 1st of each year, Gabriela receives a 5% raise on
her previous year’s salary. She wants a program that calculates and
displays the amount of her annual raises for the next three years. The
program also should calculate and display her total salary for the
three years.

Annual salary is $10,000. (The raise amounts
are $500.00, $525.00, and $551.25. The total salary is $33,101.25.)
Iv'e been trying for a couple of hours but can't seem to get it right.

#include <iostream>
 #include <iomanip>
 using namespace std;

 int main()
 {
 //declare variables
 double TOTAL_SALARY = 0.0;
 const double raise = .05;
 double year_one = 0.0;
 double year_two = 0.0;
 double year_three = 0.0;
 int current_salary = 10000;

 cout << "current salary: ";
 cin >> current_salary;
 cout << "year one: ";
 cin >> year_one;
 cout << "year two: ";
 cin >> year_two;
 cout << "year three: ";
 cin >> year_three;
 
 
 //calculate total salary 
  ;year_one = current_salary * raise;
  
  year_two = year_one * raise;
  year_three = year_two * raise;
 TOTAL_SALARY = year_one + year_two + year_three
 
 
  //end 
 ;cout << "Total SALARY: $" << TOTAL_SALARY << endl;
 

system("pause");
 return 0;
 } //end of main function

Recommended Answers

All 6 Replies

please, dont be shy. tell us what ye' problem be.

Try outputting more values so you can see if all the variables contain the expected values.

Well i try creating a C++ as you can see but i don't know how to do it and this is the best i can try to do it

Okay this let me rephrase the questions since it sounds confusing.
1.Effective January 1st of each year, Gabriela receives a 5% raise on
her previous year’s salary. She wants a program that calculates and
displays the amount of her annual raises for the next three years. Th e
program also should calculate and display her total salary for the
three years.

2.Create an IPO chart for the problem, and then desk-check the
algorithm using an annual salary of $10,000. (The raise amounts
are $500.00, $525.00, and $551.25. Th e total salary is $33,101.25.)

I have not created a IPO chart since i tried doing the C++ part first to see if i was going to be write but i really don't know what I'm doing. I wouldn't even know how to start the IPO as i don't know what goes in the input and output.

Member Avatar for MonsieurPointer

I think it's just a simple math problem:

;year_one = current_salary * raise;

If raise was 0.5and salary was 10,000, then you would end up getting only 5,000. You need to multiply by 1.05, then you should get the correct value.

I have not created a IPO chart since i tried doing the C++ part first to see if i was going to be write but i really don't know what I'm doing. I wouldn't even know how to start the IPO as i don't know what goes in the input and output.

There's your problem. You really should do the appropriate charting first. The charting makes you think it through and plan your code. It's much easier to have a plan then write code to match the plan than it is to "pull it out of thin air."

What is/are your given starting value(s)? This/these will be your input.

What is/are your given ending value(s)? This/these will be your output.

Do you remember what the P stands for in "IPO"? It stands for "Processing". Processing is how you manipulate your inputs to generate your outputs.

To correct your salary calculation issue, you have 2 options:

  1. adjust your multiplication to include the 1 and generate a direct result
  2. calculate the amount of the raise then add it to the current wages

Since you have to report the individual raise amounts, the second option is probably the better option. That way, you generate the numbers directly instead of having to extrapolate them from the other data.
i.e.:

float currentValue = 2,000.00f;
float changePercentage = .05f;

float changeAmount = currentValue * changePercentage;

std::cout << "The change amount is: " << changeAmount << std::endl;

currentValue += changeAmount;

std::cout << "The new value is: " << currentValue << std::endl;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.