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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education