Suppose that the tuition for a university is \$ 10,000 this year and increases 5% every year. Write a program that uses a loop to compute the tuition in ten years. Write another program that computes the total cost of four years worth of tuition starting 18years from now.

I am able to do the 10 year loop without much problem.
However when come to calculating 2nd part of the question i came to a halt.

Should i be doing a loop again till the 21 years and then total tuition of 18 to 21 years?
or can i call the 18th year and start the loop there to 21 years(my preference)

***i just need hints*** No code pls.Prefer to solve it on my own.

Is the 5% constant or does it change depending on the current tuition fee?

if it's the latter, you can make use of the first loop and make it loop up to 21 years(if it's allowed) then if it's the 18th year add the current tuition up to the 21st year and store it in a variable, just to be sure of the values

though if it's constant or if you already know the tuition value for the 18th year and your positive that the values up to the 21st year are correct then go ahead if you prefer this

Well... Since this is an assignment..., What I would do is...
Have one loop going right up to year 21.
When you hit year 10, display your answer to the first question.
When you hit year 18 (and above), add this to your total (for 4 years).
When you are done, display your total.

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.