Starting from:

$25

CSI365-Program 6 Program in Ada that Asks the For Integers, Sorts List and Finds Average List Solved

Learn the basics of programming with a strongly typed language 

 

Write a program in Ada that asks the user for a series of integers, sorts the list, finds the average of the list, the smallest value in the list, and displays the entire list on screen.

 

There will be no attempts to crash the program through entering illegal data types.  

 

 The program must meet the following specifications:

 

•        A comment section at the top of the file with your name, email address and a description of the program.

 

•        A function that fills an array of integers. The maximum number of integers the array will need to hold will be 100. This function asks the user for positive (non-zero, nonnegative) integer values until the user enters a value that is zero or negative. There is no guarantee the array will be filled. The function will return the array. The function does not accept any arguments.

 

•        A procedure that sorts the array. If you find a built-in sort routine in Ada, don’t use it. Write your own sort routine. Quicksort, bubble sort, I don’t care. You MUST write a sort routine. The procedure does not return the array, it sorts the array in place. Use an in out parameter for the array.

 

•        A function that determines and then returns the average of the values in an array. The average will be a floating point value. The function accepts an integer array of values.  The parameter should be an in parameter. Call this function, with the appropriate labeling of the information, at some point after the integer array is filled.

 

•        A function that determines and then returns the largest of the values in an array. The largest value will be an integer value. The function accepts an integer array of values. The parameter should an in parameter. Call this function, with the appropriate labeling of the information, at some point after the integer array is filled.

 

•        A procedure that print out the elements of the array, one per line. Only print out the positive values. Call this function, with appropriate labels, both before and after calling the sort procedure.

More products