COMP 122 Lab 6 Lab Report and Source Code COMP 122 Lab 6 Lab Report and Source Code | Seite 2
order to find the median, this function will need to sort the original data. The simplest sorting
procedure is called bubble sorting. The following pseudocode describes bubble sorting for X
valid array elements.
for ; outer < x;="" outer++="">
for ; inner < x-1;="" inner++="">
if array[inner] > array[inner+1]
swap(array[inner], array[inner+1]);
After the data has been sorted, the median value can be found. If the array has an odd number
of elements the median is the value of the middle element (Hint: arraySize/2 is the middle
element). If the array has an even number of elements then the median is the average of the
middle two elements (Hint: arraySize/2 and ( arraySize/2) - 1 are the two middle elements). The
median value should be returned by the median function. The main routine should output the
median value in an appropriate manner. The main routine should also output the sorted array
with 5 grades per line. Carefully develop test cases for your program. Most of your test cases do
not need to contain lots of values. Make sure to include incorrect inputs such as negative grade
values. Calculate what your mean and median values should be for your test cases. Document
your test cases in a Word document. Run your test cases with your program to see if your
program generates the expected output. If not, troubleshoot your program and fix the
problem. When your program executes a test case correctly, take a screen shot of the program
output and paste it into your Word document to prove that your test case executed correctly
with your program. Make sure that your code is properly formatted! You also need to make
sure you include a comment block for each function which documents the purpose, inputs, and
outputs of each function!
Create a program using Visual C++.Net. Make sure to capture a screen shot of your program
running your test cases! The best way to do this is to click on the console window you want to
capture and then press the Alt and PrintScreen keys at the same time. Then paste your
captured screen image into your Word document. Your Word document should contain your
test cases, the screen shots documenting your test cases, followed by a copy of your source
code.