$29
Programming Project #2
EGRE245
Paddock Perimeter
1 Overview
A farmer wishes to build a fence around an irregular 4-corner paddock. The farmer has
measured the position of the four corners of the paddock as (x,y) coordinates relative to his
house, as follows (don’t worry about distance units!):
(6.1,4.2)
(0,0)
(1.5,2)
(3.2,3.6)
(5,0)
Write a program to input the 8 points representing the corners of the paddock and then print
out the perimeter distance around the paddock using the formula for the distance between
two points, i.e. q
(x1 x2)2 + (y1 y2)2 .
You should store your points as single-precision floating point values (i.e. using float variables). Echo print your points in the manner illustrated in the sample run below. Print the
final distance rounded o↵ to 2 decimal places. All output should be presented exactly like it
appears in the sample fun below (with the exception of course that you will use your name
rather than mine!).
1
2 Sample Run
3 Deliverables
You should turn in a stand-alone, complete application program (your source code) containing a main function. Name your source code file proj2XXXX.c where XXXX is the last 4
digits of your student id number. For example, if your student id number is V12345678, your
file will be named proj25678.c. Projects this term will be submitted via the web using a
link o↵ of the class web page (http://danresler.net/egre245). Make sure to document
your code in the manner previously discussed in class. Note you need not turn in anything
other than your source code text file!
Due date: Thursday, January 29
2