Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database In Depth Relational Theory For Practitioners

Authors: C.J. Date

1st Edition

0596100124, 978-0596100124

More Books

Students also viewed these Databases questions

Question

What is American Polity and Governance ?

Answered: 1 week ago