help please
CMIS 102 Hands-On Lab Week 7 - Functions Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, analysis, test plan, design, and implementation with C code. The example provided uses sequential, repetition, selection statements and user-defined functions. Program Description Write a program that will allow the user to select from a variety of mathematical functions, evaluate that function at a numerical value, and keep going until the user enters a selection indicating that the user is done with the program. The program should be written in such a way that adding new functions to the source code is relatively easy Interaction A menu will be presented to the user as a prompt. The exact menu will depend upon the actual functions currently available in the program. Here is one typical interaction, where a, b, c, etc. represent function selections #include
void printHelp printf (" ") printf ("a: a(x) -x"x "); printf ("b: b(x) = x*x*x "); printf ("c: c(x) = x^2 + 21x + printf ("q: quitln") 7 "); void a (float x) float v = printf (" x*x; a(8.2f) 8.2f"2 8.2f ", v); = = x, x, // end function a void b(float x) printf (" a(8.2f) // end function h -8.2f"3-8.2f ", x, x, v); void c (float x) float v = x*x + 2*x + 7; printf ("C8.2f) 8.2f 2 2*.2f +7-.2f ", X, X,X, V) // end function oc int menu t char selection; float xi printHelp scanf ("%s", &selection); if (selection) return l; scanf ("%f", &x); if (selection-= 'a') a(x); if (selection'b') b(x) if (selection-' c') c(x); return 0 // end function menu int main) f while (menu()-0); printf ("... bye ... "); return 0 // end main 2. (x/2) Create a new function, shrink using the shown code as a template. Support your experimentation with screen captures of executing the new code. Prepare a new test table with at least 3 distinct test cases listing input and expected output for the new code you created for the shrink function. (float x), that would divide the input value by 2 3. Why is the number of x's different in the printf statements in the functions? What happens if the user makes a selection other than one of the ones shown in the help prompt (a, b, c, or q in the code shown)? Justify your answer with documented experiments. 4. What would have to be changed in the code if the while statement were changed to: while (menu 5); 5. Modify the original code and add an additional function of your choice. The function should be unique and something you created for this assignment. Support your experimentation with screen captures of executing the new code. Prepare a test table with at least 3 distinct test cases listing input and expected output for your unique function. 6. CMIS 102 Hands-On Lab Week 7 - Functions Overview This hands-on lab allows you to follow and experiment with the critical steps of developing a program including the program description, analysis, test plan, design, and implementation with C code. The example provided uses sequential, repetition, selection statements and user-defined functions. Program Description Write a program that will allow the user to select from a variety of mathematical functions, evaluate that function at a numerical value, and keep going until the user enters a selection indicating that the user is done with the program. The program should be written in such a way that adding new functions to the source code is relatively easy Interaction A menu will be presented to the user as a prompt. The exact menu will depend upon the actual functions currently available in the program. Here is one typical interaction, where a, b, c, etc. represent function selections #include void printHelp printf (" ") printf ("a: a(x) -x"x "); printf ("b: b(x) = x*x*x "); printf ("c: c(x) = x^2 + 21x + printf ("q: quitln") 7 "); void a (float x) float v = printf (" x*x; a(8.2f) 8.2f"2 8.2f ", v); = = x, x, // end function a void b(float x) printf (" a(8.2f) // end function h -8.2f"3-8.2f ", x, x, v); void c (float x) float v = x*x + 2*x + 7; printf ("C8.2f) 8.2f 2 2*.2f +7-.2f ", X, X,X, V) // end function oc int menu t char selection; float xi printHelp scanf ("%s", &selection); if (selection) return l; scanf ("%f", &x); if (selection-= 'a') a(x); if (selection'b') b(x) if (selection-' c') c(x); return 0 // end function menu int main) f while (menu()-0); printf ("... bye ... "); return 0 // end main 2. (x/2) Create a new function, shrink using the shown code as a template. Support your experimentation with screen captures of executing the new code. Prepare a new test table with at least 3 distinct test cases listing input and expected output for the new code you created for the shrink function. (float x), that would divide the input value by 2 3. Why is the number of x's different in the printf statements in the functions? What happens if the user makes a selection other than one of the ones shown in the help prompt (a, b, c, or q in the code shown)? Justify your answer with documented experiments. 4. What would have to be changed in the code if the while statement were changed to: while (menu 5); 5. Modify the original code and add an additional function of your choice. The function should be unique and something you created for this assignment. Support your experimentation with screen captures of executing the new code. Prepare a test table with at least 3 distinct test cases listing input and expected output for your unique function. 6