Question: Write a program that deals with inflation, which is essentially the rising cost of general goods over time. That is, the price of goods, such
Write a program that deals with inflation, which is essentially the rising cost of general goods over time. That is, the price of goods, such as a packet of peanuts, goes up as time goes by. So, you will 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 ol years, and the rate of inflation. The output is the estimated cost of the item after that number of years, using the given inflation rate. The user enters the inflation rate as a percentage, for example 4.5. You will have to convert the percentage to a fraction (like 0.045), and then use a loop to estimate the item's price adjusted for inflation. Note that you must check each of the values provided by the user to make sure that they are reasonable. To actually adjust the price for inflation, you need to increase the price by the inflation rate each year separately. For example, if you have an item that is initially priced at $10, with an inflation rate of 10%, then the adjusted prices will be: In other words, to calculate the price after another year, you have to use the value from the current year. NOT the original price. To do this, you have to use a while or for loop
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
