Please note global variables are not allowed to use in this assignment except of global constants.     Find Median. In statistics, the median of a set of values is the value that lies in the middle when the values are arranged in sorted order. If the set has an even number of values, then the median is taken to be the average of the two middle values. Write a C++ program that determines the median of a sorted array. In the main function, Declare and initialize two arrays. One array must contain an even number of values, for example {91, 71, 67, 78, 76, 82, 100, 89}. The other array must contain an odd number of values, for example {76, 71, 78, 67, 82}. Call a function named sortArray to sort the values in each array in ascending order. should take an array of numbers and an integer indicating the size of the array as the arguments, and sort the array in ascending order. This function does not return any value. Call another function named findMedian to find the median of the values in each sorted array. The function should take an array of numbers and an integer indicating the size of the array and return the median of the values in the array. At the end, in the main function, the program should display the sorted arrays, number of elements in the arrays, and the medians of the arrays. For example, the outputs could be: Array numSet1 after sorting is: 67  71  76  78  82  89  91  100 It has 8 values, the median of those values is: 80 Array numSet2 after sorting is: 67  71  76  78  82 It has 5 values, the median of those values is: 76   Note: In this program, you should define two functions:  sortArray, and findMedian as required. You may use the sample code in selection sort example to define sortArray function.   Debug and test your program to make sure there is no syntax and logical errors. Generate a testing report that includes at least two testing cases and testing results

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter7: Arrays
Section: Chapter Questions
Problem 1PP: (Statistics) a. Write a C++ program that reads a list of double-precision grades from the keyboard...
icon
Related questions
Question

Please note global variables are not allowed to use in this assignment except of global constants. 

 

 Find Median. In statistics, the median of a set of values is the value that lies in the middle when the values are arranged in sorted order. If the set has an even number of values, then the median is taken to be the average of the two middle values. Write a C++ program that determines the median of a sorted array. In the main function,

  • Declare and initialize two arrays. One array must contain an even number of values, for example {91, 71, 67, 78, 76, 82, 100, 89}. The other array must contain an odd number of values, for example {76, 71, 78, 67, 82}.
  • Call a function named sortArray to sort the values in each array in ascending order. should take an array of numbers and an integer indicating the size of the array as the arguments, and sort the array in ascending order. This function does not return any value.
  • Call another function named findMedian to find the median of the values in each sorted array. The function should take an array of numbers and an integer indicating the size of the array and return the median of the values in the array.
  • At the end, in the main function, the program should display the sorted arrays, number of elements in the arrays, and the medians of the arrays. For example, the outputs could be:

Array numSet1 after sorting is: 67  71  76  78  82  89  91  100

It has 8 values, the median of those values is: 80

Array numSet2 after sorting is: 67  71  76  78  82

It has 5 values, the median of those values is: 76

 

Note: In this program, you should define two functions:  sortArray, and findMedian as required. You may use the sample code in selection sort example to define sortArray function.

  Debug and test your program to make sure there is no syntax and logical errors. Generate a testing report that includes at least two testing cases and testing results. 

Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr