Week 7Overview 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 DescriptionWrite 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.InteractionA 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.>Make a selection: a: a(x) = x*x b: b(x) = x*x*x c: c(x) = x^2 + 2*x + 7 q: quit Enter selection and value, or q: a 3.45 c(3.45) = 3.45^2 + 2*3.45 + 7 = 25.80 Analysis1. Use float data types for input, calculations and results. 2. Create a main input loop to select a function or quit. 3. Create a good prompt, including a list of possible selections to help the user. 4. Include appropriate printf functions within the math functions. 5. Make the main method simple by using a while loop, and a menu function which will return a special number if the user chooses the quit option. a. while (menu () == 0); b. if the menu function returns a 0 then continue c. returning any other value will end the program. 6. Use the ^ symbol in the display to indicate a power of x, i.e., x^4 means x*x*x*x. 7. Write a simple message when the program is over, such as “… bye …”.
CMIS102
[Solved] CMIS102-Lab7- Functions
30 $
File Name: CMIS102-Lab7-_Functions.zip
File Size: 216.66 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.