Computing tuition Need Help please!

The question is: Suppose that the tuition for a university is $10,000 this year and increases 5% every year. Write a program that computes the tuition in ten years and the total cost of four years' worth of tuition starting ten years from now.

The correct answers to this program should be:

The tuition after 10 years is $16288.9
Tuition in year 1 is $16288.9
Tuition in year 2 is $17103.4
Tuition in year 3 is $17958.6
Tuition in year 4 is $18856.5
4 year total tuition is $70207.4

I have wrote the first part of the program but am not sure how to go from here. Any help is appreciated! This is what I have so far:


#include<iostream>
using namespace std;

int main ()
{
double tuition = (10000);
int year = 1;

for (int i = 1; i <= 10; i++)
{
tuition = ((tuition * .05) + tuition);

}
cout << "Tuition after 10 years is: " << tuition << endl;

return 0;
}
Last edited on
Use the 10-year tution as a base and sum up 4 years in a separate variable should do that.
Topic archived. No new replies allowed.