homework10

# homework10 - ECE 1574 Homework Set #10 Problem Solving with...

This preview shows pages 1–2. Sign up to view the full content.

ECE 1574 Homework Set #10 Problem Solving with C++ Due date: Monday evening, 4/5/10 by 11:55 p.m. This assignment is to be done individually Complete the lab exercise and answer questions 1 and 2 during the lab session. Answer the other questions later. LAB EXERCISE Write, compile, test and execute a program which does the following. From a file “data.txt”, reads in and stores as a linked list on the heap a series of latitude-longitude pairs, with south latitudes and west longitudes represented as negative numbers, where the format of “data.txt” resembles 43.6 -116.2 47.6 -122.3 40.8 -111.9 and so forth. (Observe incidentally that the latitudes and longitudes listed happen respectively to be those of Boise, Seattle and Salt Lake.) After storing the complete linked list, for each member of the list, calculates the average direct (not great-circle) distance in miles from Virginia Tech of the several latitude-longitude pairs from Virginia Tech—whose latitude and longitude respectively are 37.2 and -80.4. (To calculate the direct distance, the computer should convert each latitude-longitude pair into x-y-z coordinates, with the Cartesian origin at the earth’s center and the z -axis running through the earth’s poles, then apply the Pythagorean theorem. The computer will need to know that the earth’s radius is 3959 miles. As a check case, the direct distance of Boise from Virginia Tech happens to be 1900 miles. Note that it is unnecessary to store the several distances merely to compute an average: it suffices to keep a running total.) Properly deletes the entire linked list. (Beware: there is a wrong way and a right way to do this. Given a user-defined object on the heap which contains a pointer,

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 02/15/2011 for the course ECE 1574 taught by Professor Rpbroadwater during the Spring '08 term at Virginia Tech.

### Page1 / 5

homework10 - ECE 1574 Homework Set #10 Problem Solving with...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online