At one college, the tuition for a full-time student is $8,000 per semester. It has been announced that the tuition will increase by 3 percent each year for the next 5 years. Write a program with a loop that displays the projected semester tuition amount for the next 5 years.
The program should print out the result in the form
In 1 year, the tuition will be $8002.3.
In 2 years, the tuition will be $8103.2.
In 3 years, …
In 4 years, …
In 5 years, …
(If, for example, the tuition would cost 8002.3dollars in one year, etc.)
Sample Run
In 1 year, the tuition will be $8240.0.↵
In 2 years, the tuition will be $8487.2.↵
In 3 years, the tuition will be $8741.816.↵
In 4 years, the tuition will be $9004.07048.↵
In 5 years, the tuition will be $9274.192594400001.
you don't sum tuition_total value to tuition_total value calculated from the previous step try it on following way.
tuition_total = ((tuition * tuition_increase) + tuition) + tuition_total
or
tuition_total += (tuition * tuition_increase) + tuition
Comments
Leave a comment