Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This assignment focuses on some the basic elements of programming and using conc

ID: 669094 • Letter: T

Question

This assignment focuses on some the basic elements of programming and using concepts of repeating operations. It will use two different methods of computing an area of a quadrilateral in analytic geometry. Once you have solved the mathematics of the problem. Add a do while around the calculations that will allow the user to make another calculation without exiting the program. Carefully consider what commands should be inside the loop and what should be outside the loop.

The input to your program will be four ordered pairs, representing points in two-dimensional analytic geometry. (Think back to high-school algebra, or Physics 211).

The first output from your program will use the following formula discovered in the eighteenth century:

Because entering the points in a clockwise manner will result in a negative area, correct the formula by taking the absolute value of the area calculated above.

Next, consider dividing the quadrilateral into two triangles by constructing a diagonal between the first and third vertices:

An ancient Greek geometer came up with Hero's formula for computing the area of a triangle. Given triangle sides a, b, c and the semiperimeter s (i.e. half of the perimeter), the area is equal to:

To compute the lengths of the sides and diagonal, you will need the formula for the distance between 2 points. Given Hero’s formula, one would then expect the quadrilateral to have an area equal to the sum of two triangles.

Display all results using 8 significant figures. Use a do-while loop to ask the user if he/she would like to make another calculation. At this time only ask the user to enter a Y or N as the prompt below shows. You should assume that any answer other than Y or y means he/she does not want to do another calculation.

Using C++ programming.

Area--

Explanation / Answer

working c++ code

#include<iostream>

#include<math.h>

using namespace std;

int main()

{

    float first,second,third,fourth;

    float s,area,s1,area1;

    cout<<"Enter size of each sides of Quadrilateral "<<endl;

    cout<<"Enter size for First Side =";

    cin>>first;

    cout<<"Enter size for Second Side =";

    cin>>second;

    cout<<"Enter size for Third Side =";

    cin>>third;
  
    cout<<"Enter size for fourth Side =";

    cin>>fourth;
  
  

    s = (first+second+third)/2;

    area = sqrt(s*(s-first)*(s-second)*(s-third));
  
   s1 = (first+fourth+third)/2;

    area1 = sqrt(s1*(s1-first)*(s1-fourth)*(s1-third));

    cout<<"Area of Quadrilateral is= "<<(area+area1)<<endl;

    return 0;

}