CS 172 Lab 6: Unconstrained Arrays and Random Values
This lab looks at generating random values, using unconstrained arrays
and sorting. It lets you practice the unconstrained array and
sorting ideas from Ch. 11 and 12 respectively.
- Launch Windows Explorer. Remember
to set the View Options so that known file extensions are NOT
hidden. View your Y:\Ada subdirectory.
- Save the following link:
RandomSortLab.adb
Save the file as Y:\Ada\RandomSortLab.adb
View the directory
listing in Windows Explorer to confirm that the file is now in
your Y:\Ada subdirectory.
- Launch AdaGIDE. Open the file you just created,
Y:\Ada\RandomSortLab.adb.
- The code is an Ada program that has comments that indicate
what its functionality should be. Your task is to:
- Implement a Swap procedure from scratch. This procedure is
called in the SortScoreArray procedure, but not defined anywhere.
- Complete the definition of the MedianOfSortedScores function. The
"median" of a sorted list of values is the "middle" value. For
example, the median of 12, 34, 56, 92, 111 is 56. When there are an
even number of elements, the median should be the earlier of the two
middle values. For example, the median of 1, 2, 3, 4 is 2. Note
that integer division will be helpful here. Be careful that your
code works even when the array index does not start with 1.
- Complete the implementation of the DoEverything procedure. The
comment should clearly indicate what is required here. Notice that
you are asked to output the minimum and maximum values, as well as
the median. You will need to determine what these values are.
- When you are ready you should bring me:
- a printout of your program listing and
- upload your source code