{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

c16_ps06_sol

# c16_ps06_sol - C-16 Solutions 1 Record Declaration type...

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

C-16 Solutions 1. Record Declaration type Aircraft_Information is record Aircraft_Number : Integer; Latitude : Float; Longitude : Float; Heading : Float; Velocity : Float; end record ; Note there are multiple ways to do this record declaration. You may for instance choose to use a hierachical record wherein the position information (Latitude, Longitude, Heading, Velocity) is a record within Aircraft_Information as shown below: type Position_Information is record Latitude : Float; Longitude : Float; Heading : Float; Velocity : Float; end record ; type Aircraft_Information is record Aircraft_Number : Integer; Aircraft_Position : Position_Information; end record ; 2. Ada Program Data Structures Array of 10 elements of Type Aircraft_Information Subprograms o Function to create the array of aircraft o Procedure to sort the contents of the array based on latitude o Procedure to compute and display the distances between the first aircraft and all other aircraft.

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

View Full Document
Algorithms Create_Aircraft: For I in 1 . . 10 Prompt the user to input relevant information Store the information in Array(I) Return Array to the main program Sort_Aircraft: For I in 1 . . Num_of_Aircraft -1 For J in I+1 . . Num_Of_Aircraft If Array(I).Latitude > Array(J).Latitude Swap the records in Array(I) and Array(J) Return sorted array to the user Compute_Distances: For I in 2 . . Num_Of_Aircraft Compute difference in latitudes (dlat) Compute the differences in longitude (dlon) Covert the differences into distances using the WGS-84 approximations in the handout (dlat_dist, dlon_dist) Distance between the aircraft = sqrt(dlat_dist^2 + dlon_dist^2) Display computed distance to the user. Main Program:
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

c16_ps06_sol - C-16 Solutions 1 Record Declaration type...

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

View Full Document
Ask a homework question - tutors are online