Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1) Explain what is wrong with the following code fragment? (Find any errors and

ID: 3586269 • Letter: 1

Question

1) Explain what is wrong with the following code fragment? (Find any errors and explain how would you fix it in the following code fragment In that vein, it has NOTHING to do with the comment. The comment merely tells what else would have gone on between the variable declarations and the assignment statement.) double rate; long start_popul, end_popul // fill in start and end_popul with data /..probably using a cin) rate - end_popul /start_popul; Now tell me the name of the method we use to fix this situation and show how it would be applied here. 2)Find any errors and explain how would you fix it in the following code fragment (they may be logic or syntax- but NOT stylistic errors). Tip: This is a code fragment! Any errors we are interested in will not be about things that would have happened before or will happen after these lines!) min-approx = flooring ( min exact +15 - 15;

Explanation / Answer

1. Answer for 1st question :-

2. Answer for 2nd question :-

You have to use "floor" function not "flooring" function

"floor" function present inside cmath library. So add library path "# include <cmath>" in your code.

Please find below example to get more idea :

#include <iostream>

using namespace std;

#include <cmath>

int main() {
double rate=15.0d;
int min_approx=0;
float min_exact=20.25;
min_approx=floor(min_exact
+15
/.5)
-15;
cout<<min_approx;
return 0;
}