Program 3

advertisement
Program 3
Functions, Files and a Survey
Problem
Estimate the acreage of a parcel of land based upon a collection of survey measurements. Suppose that
the parcel is bounded on the east and west by roads that follow a due north-south heading. A surveyor
and two assistants walk paths as follows:
1. The northern-most assistant walks and marks the northern boundary always remaining due
north of the surveyor;
2. The southern-most assistant walks and marks the southern boundary always remaining due
south of the surveyor;
3. The surveyor walks due east from the western boundary to the eastern boundary:
a. Stopping to make and record measurements every 10 feet;
b. Recording the distances to the assistants as tuples (n, s), where n and s are the
distances to the northernmost and southernmost assistants, respectively.
The surveyor’s measurements are recorded in a text file, one measurement pair per line. You must
develop a program that reads the file and estimates the overall acreage of the parcel.
Requirements
Your program must:
1. Acquire data from
a. A user regarding the user’s name and the parcel name and location
b. The surveyor file.
2. Display on the screen and store output in a text file indicating:
a. The user’s name and address;
b. The parcel name and location;
c. The estimated acreage of the parcel.
Download