Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

Area Under Curve

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b.
The area under a curve between two points can be found by doing a definite integral between the two points.

Instructions to work with Open PBT Client:

  1. Specify the work directory path in the 'Work directory Path' field. The path should correspond to your solution Work directory.
  2. Download the support files by clicking the Get Support Files.
  3. You will find the problem directories containing:
    • problem.h file
    • problem.c file

in your project directory.

  1. Code the solution in.c file inside the problem directory
  2. All required files will be downloaded to your work directory. Creating additional files is strongly discouraged.

The Prototype of the Function is :

double getAreaUnderCurve (struct Term* equation, int noOfTerms, int limit1,int limit2)

  • Where equation represents number of Term in a equation with x_pow and coeff of X
  • Where noOfTerms is the number of terms in the equation
  • Where limit1 and limit2 are the 2 given points to find the area.
  • The function getAreaUnderCurve() return the area of type double corrected to 4 decimal places.(eg : 5.2704. )

Example 1

Input :


    Term equation = x + 3(x^2);     int noOfTerms = 2;     int limit1 = 4;     int limit2 = 8;
    where, struct Term* equation => { equation[0].exponent = 1; equation[0].coefficient = 1; equation[1].exponent = 2; equation[1].coefficient = 3; }

Output :


The function getAreaUnderCurve() returns 472.0.

 

Example 2

Input :


    Term[] equation = x;     int noOfTerms = 1;     int limit1 = 1;     int limit2 = 1;

Output :


The function getAreaUnderCurve() returns 0.0

Example 3

Input :


    Term equation = x;     int noOfTerms = 1;     int limit1 = 2;     int limit2 = 1;

Output :


The function getAreaUnderCurve() returns 1.5

For C solutions

Header File

:

areaundercurve.h

Function Name

:

double getAreaUnderCurve (struct Term* equation, int noOfTerms, int limit1,int limit2)

 

File Name

:

areaundercurve.c

 

For C++ solutions

Header File

:

areaundercurve.h

Class Name

:

AreaUnderCurve

Function Name

:

double getAreaUnderCurve (struct Term* equation, int noOfTerms, int limit1,int limit2)

FileName

:

areaundercurve.c

General Instructions

    *

The file / class names, functions, method signatures, header files are to be used as mentioned in the problem statement. Do not use your own names or change the method signatures and fields. You can add any number of additional methods.

    *

For C solutions, change the value of "C_OR_CPP" macro in header file as 1 and for C++ solutions change the value as 2.

    *

Incase of iostream.h specify as iostream only.

    *

Command line options for the main() function are not supported currently.

 

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9506575

Have any Question?


Related Questions in Programming Language

1 write a function named check that has three parameters

1. Write a function named check () that has three parameters. The first parameter should accept an integer number, andthe second and third parameters should accept a double-precision number. The function body should just ...

Assignment - horse race meetingthe assignment will assess

Assignment - Horse Race Meeting The Assignment will assess competencies for ICTPRG524 Develop high level object-oriented class specifications. Summary The assignment is to design the classes that are necessary for the ad ...

Assignmentquestion onegiving the following code snippet

Assignment Question One Giving the following code snippet. What kind of errors you will get and how can you correct it. A. public class HelloJava { public static void main(String args[]) { int x=10; int y=2; System.out.p ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Question 1 what is a computer program what is structured

Question: 1. What is a Computer program? What is structured programming? 2. What is modular programming? Why we use it? 3. Please evaluate Sin (x) by infinite series. Then write an algorithm to implement it with up to th ...

Background informationthis assignment tests your

Background Information This assignment tests your understanding of and ability to apply the programming concepts we have covered throughout the unit. The concepts covered in the second half of the unit build upon the fun ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Question - create a microsoft word macro using vba visual

Question - Create a Microsoft Word macro using VBA (Visual Basic for Applications). Name the macro "highlight." The macro should highlight every third line of text in a document. (Imagine creating highlighting that will ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As