Question: INFLATION.CPP Write a program that gauges the rate of inflation over the past year. The program asks for the price of an item (such as

 INFLATION.CPP Write a program that gauges the rate of inflation over

INFLATION.CPP Write a program that gauges the rate of inflation over the past year. The program asks for the price of an item (such as a hot dog or a 1-carat diamond) both from one year ago and today. It estimates the inflation rate as the difference in price divided by the year-ago price. Your program should allow the user to repeat this calculation as often as the user wishes. Define a function to compute the rate of inflation. The inflation rate should be a value of type double giving the rate as a percent, for example 5.32 for 5.32 percent. The inflation rate must be displayed to exactly two digits after the decimal point. REQUIREMENT: Your program must use a function to compute the rate of inflation. A program which does not use a function will be awarded a score of zero, even if all tests pass. You are only permitted to use the iostream library. These requirements will be checked by the instructor and the TAs. STYLING: You must follow the styling conventions that we have been discussing in class. I have posted a list of these conventions on Piazza. Additionally, the program must make good use of comments in the code, per the discussions we have been having in class. Again, proper styling and the presence of comments (and thier good use) will be checked by the instructor and the TAs A session should look exactly like the following example (including whitespace and formatting - note that there is no whitespace at the end of each of these lines and each printed line has a newline at the end), with all manners of different numbers for inputs and the output: Enter the old price (or zero to quit) 450 Enter the new price: 500 The inflation rate is 11.11% Enter the old price (or zero to quit): 30 Enter the new price: The inflation rate is 83.33% Enter the old price (or zero to quit) 9000 Enter the new price: 8750 The inflation rate is -2.78%

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!