Sale!

COP3223C Small Program 6 Solved

Original price was: $35.00.Current price is: $30.00.

Download Details:

  • Name: smallprogram6-tlq8ed.zip
  • Type: zip
  • Size: 229.49 KB

Category:

Description

5/5 - (1 vote)

Problem 1

Write a user defined function called meanMinMax that takes an int array as an argument. The
function will use the array that is declared in the main function that contains SIZE elements. The
function will calculate the mean of the values stored in the array and also determine the max
and min values inside the array within the function definition.

 

These results will be displayed in
the user defined function definition. The following figure shows a sample output of the problem.
Read the Important section of this assignment to understand the array you are using for
all of these problems.
Figure 3: Sample output from problem 1. Make sure it matches for the python script.

Problem 2

Write a user defined function called mySort that takes an int array (same one from the previous
problem) as an argument. The function will sort the array in increasing order. Do not use any
built in sorting function.

If a built in sorting function is used, then no credit will be given for
this problem. The following figure shows a sample output of the problem. Call the display
function after calling mySort in the main function.
Figure 4: Sample output from problem 2 from calling display after mySort. Make sure it matches
for the python script.
Small Program 6 Page 4

Problem 3

Write a user defined function called doubleShift. This function shifts values over by 2 indexes
to the right (increasing index) in the array. Here is an example when the array has 5 elements
before and after the function is called. The function takes the int array (same one from previous
problems) as an argument.

Figure 5: Sample of how doubleShift works with an array of 5 elements.
Call the display function after calling doubleShift in the main function.
Figure 6: Sample output from problem 3 from calling display after doubleShift. Make sure it
matches for the python script.
Small Program 6 Page 5

Problem 4

Write a user-defined function called reverse. The function flips the position of the values in
reverse order. The following figure shows a sample with an array of 5 elements. You cannot use
Figure 7: Sample of how reverse works with an array of 5 elements.

an additional array for this problem. If an additional array is used, then points will be deducted.
Call the display function after calling reverse in the main function.
Figure 8: Sample output from problem 4 from calling display after reverse. Make sure it matches
for the python script.
Small Program 6 Page 6