Question: #include using namespace std; /* * InflationRate - calculates the inflation rate given the old and new consumer price index * @param old_cpi: is the

#include using namespace std;

/* * InflationRate - calculates the inflation rate given the old and new consumer price index * @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 0 if inputs are invalid. */ double InflationRate(float old_cpi, float 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

float oldCPI; float newCPI; float iRate; float sum=0; // TODO #2: Read in two float values for the cpi and store them in the variables do { cout > oldCPI >> newCPI;

// T7ODO #3: call the function InflationRate with the two cpis

iRate = InflationRate(oldCPI, newCPI);

// TODO #4: print the results

cout

return 0; }

// double InflationRate(float old_cpi, float new_cpi) // precondition: both prices must be greater than 0.0 // postcondition: the inflation rate is returned or 0 for invalid inputs double InflationRate(float old_cpi, float new_cpi) { // TODO: Implement InflationRate to calculate the percentage increase or decrease // Use (new_cpi - old_cpi) / old_cpi * 100

double results;

if (old_cpi > 0 && new_cpi > 0) { results = (new_cpi - old_cpi) / old_cpi * 100; return results; } return 0; }

I'm not sure where I'm going wrong, please debug the program for me!

Part 1 Output: Enter the old and new consumer price indices: 238.170 239.513 Inflation rate is 0.563884

Part 2 Output:

Enter the old and new consumer price indices: 238.343 238.250 Inflation rate is -0.0390204 Try again? (y or Y): y Enter the old and new consumer price indices: 238.250 237.852 Inflation rate is -0.167049 Try again? (y or Y): n Average rate is -0.103035

#include using namespace std; /* * InflationRate - calculates the inflation rategiven the old and new consumer price index * @param old_cpi: is

La MimiIDE C Gel Homework Help With Cheys + 2 X ce focused-nerthus.ide.mimir.io/# * M File File Mimir Mimir View Tools Find Help Upload Submit AZWAD SOURAV Files G+ Inflation Rate.cpp 1 #include using namespace std; 3 term3 X InflationRate.cpp: In function 'int main()': InflationRate.cpp:34:12: error: 'count' was not declared in this scope count++; AN InflationRate.cpp:44:8: error: expected 'while' before 'InflationRate' double InflationRate (Float old_epi, float rew_spi) InflationRate.cpp:44:8: error: expected 'f' before 'InflationRate' double InflationRate (float old cpi, float new_cpi) 'float" InflationRate.cpp:44:22: error: expected primary-expression before double InflationRate (float old cpi, float new cpi) InflationRate.cpp:44:37: error: expected primary expression before 'float' double Inflationen (float old_epi, float rew_pi) InflationRate.cpp:44:51: error: expected before 'r' token double InflationRate (float old cpi, float new cpi) 2000_csii_sp21 00_inflationrate parti a.out G+ InflationRate.cpp practice_exercise_pow cisc1600_computer_sciend grade.cpp bash_history bashrc 0 .profile .viminfo Ci G cookie.cpp * exercise3.cpp Chw.cpp Lab 1 namepractice.cpp untitled 5 * InflationRate - calculates the inflation rate given the old and new consumer price index 6 * @param old_cpi: is the consumer price index that it was a year a ago 7 * @param new_cpi: is the consumer price index that it is currently 8 * @returns the computed inflation rate or @ if inputs are invalid. 9 18 double InflationRate(float old_cpi, float new_cpi); 11 12 int main() //C++ programs start by executing the function main 13 // TODO #1: declare two float variables for the old consumer price index (cpi) and the new cpi 15 16 float oldCPI; 17 float newCPI; 18 float Rate; 19 float sum=; 28 // TODO #2: Read in two float values for the cpi and store them in the variables 21 do 22- [ 23 cout > OldCPI >> newCPI; 25 26 // T7ODO #3: call the function InflationRate with the two cpis 27 28 iRate = InflationRate(oldCPI, newCPI); InflationRate.cpp:44:51: error: expected ';' before 'f' token double Inflationale (float old_cpi, float new_cpi) InflationRate.cpp:51:8: error: 'old_opi' was not declared in this scope if (old cpi > O new_cpi > 0) InflationRate.cpp:51:23: error: 'new_pi' was not declared in this soos if (old cpi > O 56 new_opi > 0) InflationRate.cpp:57:1: error: expected 'y' at end of input. Line 13, Column 2 UTF-8 C and C++ 1:25 AM 2/10/2021 H Type here to search o 9 A. 99+ La MimiIDE C Gel Homework Help With Cheys + 2 X ce focused-nerthus.ide.mimir.io/# * M File Mimir View Tools Find Help Upload Submit AZWAD SOURAV Files G+ Inflation Rate.cpp term3 iRate = InflationRate(oldCPI, newCPI); InflationRate.cpp:44:8: error: expected before InflationRate' double Inflation ate (float old cpi, float new cpi) // TODO 4: print the results 27 28 29 30 31 32 33 34 35 InflationRate.cpp:44:22: error: expected primary-expression before 'float' double Inflationfiatc(float old pi, float new_cpi) cout && new_cpi > 0) 52 - { [ 53 results - (new_cpi - old_cpi) / old_cpi * 100; return results; 55 } 56 return; InflationRate.cpp:51:8: error: 'old_opi' was not declared in this scope ir (old_opi > OS new_cpi > 0) InflationRate.cpp:51:23: error: 'new_spi' was not declared in this scope if (old cpi > Obd new_cpi > 0) InflationRate.cpp:57:1: error: expected '}' at end of input InflationRate.cpp:13:1: note: to match this i 57 assermimir: -/2000_cxii_sp21/00_inflationrate_purt.1 > | Line 13, Column 2 UTF-8 C and C++ 1:25 AM CO 2/10/2021 H Type here to search O 9 lor 99+

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!