# future-price-text.py
#
# Future Value - text version
#It is difficult to make a budget that spans several years,
#because prices are not stable. If your company needs 200 pencils
#per year, you cannot simply use this year's price as the cost of
#pencils two years from now. Because of inflation the cost is likely
#to be higher than it is today.
#
#Write a program to gauge the expected cost of an item in a specified
#number of years. The program asks for the cost of the item,
#the number of years from now that the item will be purchased,
# and the rate of inflation. The program then outputs the estimated
#cost of the item after the specified period.
#Have the user enter the inflation rate as a percentage, like 5.6 (%).
#Your program should then convert the percent to a fraction, like 0.056,
#and should use a loop to estimate the price adjusted for inflation.
def main():
print("This program calculates the expected price of an item")
price = float(input("Please, input the today's price of an item: "))
years = int(input("Please, input the number of years from now that the item will be purchased: "))
inflation = float(input("Please, input the inflation rate: "))
inflation = inflation/100.0
starting_price = price # preserving the starting price
# calculating the price in ... years
for i in range(years):
price = price+price*inflation
#print("price = ", price)
#Displaying the result in the graphics window
phrase = "The starting price is "+str(starting_price)+",\n In "+\
str(years)+" years the price will be $"+str(round(price,2))
print(phrase)
main()