Write a function called area_000 which will find the area in acres and the perim
ID: 3554054 • Letter: W
Question
Write a function called area_000 which will find the area in acres and the perimeter in feet of a plot of land, given the x-y coordinates for points P1, P2, P3, P4, comprising the four corners of the land. Make the function inter-active such that the user is told what the function is about, and then prompted to type the values for these 8 values from the keyboard.
Use the following data for the funtion:
Point X-Coordinate(feet) Y-Coordinate(feet)
P1 350 60
P2 375 380
P3 490 440
P4 580 25
Please do not try answering or commenting on the question with soliciting your businesss.
Answering on here would be great.
Explanation / Answer
clear all
clc
P1X=input('Input X coordinate of P1 ');
P1Y=input('Input Y coordinate of P1 ');
P2X=input('Input X coordinate of P2 ');
P2Y=input('Input Y coordinate of P2 ');
P3X=input('Input X coordinate of P3 ');
P3Y=input('Input Y coordinate of P3 ');
P4X=input('Input X coordinate of P4 ');
P4Y=input('Input Y coordinate of P4 ');
a=sqrt((P2X-P1X)^2+(P2Y-P1Y)^2); %sides
b=sqrt((P3X-P2X)^2+(P3Y-P2Y)^2);
c=sqrt((P4X-P3X)^2+(P4Y-P3Y)^2);
d=sqrt((P4X-P1X)^2+(P4Y-P1Y)^2);
d1=sqrt((P2X-P4X)^2+(P2Y-P4Y)^2); %diagonal 1
d2=sqrt((P3X-P1X)^2+(P3Y-P1Y)^2); %diagonal 2
perimeter=a+b+c+d
s=perimeter/2;
area=sqrt((s-a)*(s-b)*(s-c)*(s-d)-1/4 *(a*c+b*d+d1*d2)*(a*c+b*d-d1*d2))
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.