In: Computer Science
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.3 dollars 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.↵
I have done this program in Python. Please ask me if need any modification or changes.
CODE: Python Programming Language
def main():
# Initialize the amount with 8000
amount = 8000.0
# Use for loop to find the amount for each year
after increasing the tution fee by 3 percent
for i in range(1, 6):
# increement the amount
by 3 percent
amount += amount *
0.03
# Display the tution fee
for each year
if i is 1:
print('In ' + str(i) + ' year, the tuition will be $' +
str(amount) + '.')
else:
print('In ' + str(i) + ' years, the tuition will be $' +
str(amount) + '.')
main()
===========================================================================
SCREENSHOT OF THE CODE:
===========================================================================
OUTPUT:
Thank you. Please ask me if you have any doubt.