Question: pls do in C++ Also pls use the bottom image as a Starter Code InfationRate Part1 Instructions Write a program to take in two consumer

pls do in C++

pls do in C++ Also pls use the bottom image as a

Starter Code InfationRate Part1 Instructions Write a program to take in two

Also pls use the bottom image as a Starter Code

consumer price indexes via user input, calculate the inflation rate with the

InfationRate Part1 Instructions Write a program to take in two consumer price indexes via user input, calculate the inflation rate with the calcInflationRate function, and print out the inflation rate. 1. Start with the student starter code and follow the instructions in the code. 2. Instructions to complete are tagged in comments like the ones below. They will always begin with // TODO. // TODO \#1: declare two float variables for the old consumer price index (cpi) and the new cpi // TODO \#2: Read in two float values for the cpi and store them in the variables br r // TODO \#3: call the function calcInflationRate with the two cpis // TODO #4 : print the results 3. Once you have this program working, submit it on the autograder for credit. 4. Advance to the next lab InflationRate Part2 (next page). - Standard Test Enter the old and new consumer price indices: 238.170239.513 Inflation rate is 0.563884 - Test for positive inflation rate Enter the old and new consumer price indices: 226.655227.663 Inflation rate is 0.444727 - Test for negative inflation rate Enter the old and new consumer price indices: 230.085229.815 Inflation rate is 0.11735 using namespace std; ** calcInflationRate - calculates the inflation rate given the old and new consumer price index (both must be greater than ) * @param old_cpi: is the consumer price index that it was a year ago * @param new_cpi: is the consumer price index that it is currently * @returns the computed inflation rate or if inputs are invalid. */ double calcInflationRate(double old_cpi, double new_cpi); int main() //C++ programs start by executing the function main \{ // TODO \#1: declare two float variables for the old consumer price index (cpi) and the new cpi // TODO \#2: Read in two float values for the cpi and store them in the variables // TODO \#3: call the function calcInflationRate with the two cpis // TODO \#4: print the results return / double calcInflationRate(float old_cpi, float new_cpi) / precondition: both prices must be greater than . postcondition: the inflation rate is returned or for invalid inputs ouble calcInflationRate(double old_cpi, double new_cpi) // TODO: Implement InflationRate to calculate the percentage increase or decrease // Use (new_cpi - old_cpi) / old_cpi 100

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!