Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 4 : Structured Programming In C Language The task is to create second-degree polynomial calculator for the function, its integral and its derivative. A

Assignment 4: Structured Programming In C Language

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:

image text in transcribed

Evaluation of the derivative gives the instantaneous slope or rate of change as (where image text in transcribed is the derivative of image text in transcribed):

image text in transcribed

The integral of the function image text in transcribed (let us call it image text in transcribed) indicates the area underneath the curve. Between points image text in transcribed and image text in transcribed, the area A is

image text in transcribed

where, for a second-degree polynomial,

image text in transcribed

Your program will be used to create a table of data of the independent variable x versus f(x), f'(x) and A. The user will enter the polynomial coefficients {a,b,c} as well as the starting value of x (denote it xi), the final value of x (denote it xf), and the increment value between successive x values (denote it image text in transcribed).

Follow these detailed instructions:

1.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 the main().

2.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, xf and image text in transcribed. Use double for all variables and calculations.

3.Your program is to loop over all possible x values in your function. The first x value is to be xi, the second xi+image text in transcribed, etc. with the last value being xf (or somewhat less than xf if image text in transcribed does not divide evenly into the range).

4.The calculation of the area A depends on the initial value of x, xi.That is, for each x, we calculate the area as image text in transcribed . In order to calculate A, you must know both x and xi. For the first value of x, it should be that A is zero.

5.From the main() and for each x, you are to call a call-by-reference function that accepts a, b, c, x and xi that calculates and returns (via pointer operations) f(x), f'(x) and A. That is, you must create a single function that accepts five input parameters (a, b, c, x and xi), and returns three outputs (related to f(x), f'(x) and A). There must not be any scan/print statements in your function.

6.Your function uses the values of a, b and c along with the value of x to compute image text in transcribed . Similarly, the derivative is computed as image text in transcribed . Then, using xi in addition to the other parameters, compute image text in transcribed and image text in transcribed . The area is found as image text in transcribed . Return the result of your calculations back to the function (it will be necessary to reference your outputs via pointers).

7.All output for your table of x versus f(x), f'(x) and A must be displayed via statements in your main() function. Write your table to the terminal (i.e., the default output for printf()). Choose a suitable format for your output numbers.

f(x) = ar2 + br+ c f(x) = ar2 + br+ c

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

The nature and importance of the global marketplace.

Answered: 1 week ago