1. Engineering
  2. Computer Science
  3. need some help with an assignment programmed in c i...

Question: need some help with an assignment programmed in c i...

Question details

Need some help with an assignment programmed in C. I already have it basically done, but I am having an issues with following the instructions. I am able to get scanf and printf statements in my first call by reference function, but I do not know how to transfer the values to a separate call by reference function without repeating the scanf process. For example, I have my first call by reference function(F_x) scanf (a,b,c,x,x_i) and printf the equation, I do not know how to transfer these values over to my next call by reference function without re-scanning (making it not so user friendly).Assignment 1: Structured Programming The task is to create second-degree polynomial calculator for the function, its integral and its derivative. A second-degree polynomial is described by the equation f(x) = a +bx +c Evaluation of the derivative gives the instantaneous slope or rate of change as (where x)is the derivative of /(x)): f(x 2ax+b The integral of the function f (x) (et us call it F(x)) indicates the area undemeath the curve. Between points Xi and x2, the area A is where, for a second-degree polynomial, Ca Your program will be used to create a table of data of the independent variable xversus f(x), (x) and A. The user will enter the polynomial coefficients (a,b,c) as well as the value between successive x values (denote it Ax)Follow these detailed instructions; 1. First, read this document in its entirety. After reading this handout, you may option ally create a design sheet for the problem. Your design sheet should help you determine what header files, functions and variables you will need as well as identifying expected test results. You do NOT turn in your design sheet When you write your code, include the usual (detailed) comment block including program name, author, date, inputs, outputs and description 2. 3. Create a function of type void to explain the program to the user with the description printed to the terminal. Do not forget to call the function from main() 4. Input the data while executing from your main function. Query the user to enter the data. You must enter the parameters from the user in the following order: a, b, c and then xi , x, and Дж. Use double for all variables and calculations.5. Your progam istoloop over all possible x valuesinyourmain() function. The first x value is to be x,, the second x, +hr, etc. with the la st value being x, (or som ewhatlessthan x, if hx doesnot divide evenly into the range) 6. The calculation of the areaA depends on the initialvalue of x, x, . Thatis, for eachx we calculate the area as A-F)-Fx) In order to calculate A youm ust know bothx and x, For the first value of x, it should be that Ais zero 7. From main() andforeachx, you are to call a function that acceptsa, b, c, x and x, Calculate andretun (via pointer operations (x), fx) and.A. Thatis, youm ust create a singje function that acceptseight inputs-five are callby-value (a, b, c, x and x), and three are callby-reference (pointersrelatedto (and.A). There must not be any scanvprint statementsin yourfunction. 8. Your function uses the values ofa, b andc alongwiththe value ofx to compute f(x)+bx+c. Sim ilarly, the derivative is com puted as f (x)-2ax +b.Then, using x in addition to the other parameters, compute F(x)-- +- + cx, and P)+cx.The area isfound as A-P)P).Retum the result of vour calculationsbackto the maint) function(it will benecessarytoreference vor outputsvia pointers) 9. All output for yourtable of x versus/(x), f (x) andAmust be displayedvia statem ents inyourmain() function. Write your table to the term inal(i e, the defaut output for printf)).Choose a suitable form at foryour output numbers.10 . An ex am ple of what the output taЫе should look like is gven below. Assume that the user enters2.0 -2.0 -1.Ofora, b, c, respectively, and0.0 5.0 0.25for x,, x, and hx, respectively. Your output should be the following f(x) = 2x2 +-2x +-1 f (x) f (x) A 0.000-1.000 -2.000 0.000 0.250 -1.375-1.000 -0.302 0.500-1.500 0.000 .667 0.750-1.375 1.000 -1.000 2.000 -1.333 1.250 -0.375 3.000 1.500 0.500 4.000 -1.500 1.750 1.625 5.000 -1.2 40 2.000 3.000 6.000 -0. 667 2.2504. 625 7.000 0.281 2.500 6.500 8.000 1.667 2. 750 8. 625 9.000 3.552 3.000 3.250 3.500 3 .750 19.625 13.000 17.344 4.000 23.000 14.000 22.667 4.250 4. 500 30.500 16.000 36.000 4. 750 34.625 17.000 44. 135 5.000 -1.031 -1.510 11.000 10.000 6.000 13.625 16.500 000 9.073 000 12.833 26.625 15.000 28.865 39.000 18.000 53.333 11.Use the test set as given above

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution