Calculate and output the mean and median of collected data

Assignment Help Basic Computer Science
Reference no: EM13306873

Design a program that will allow some number of grades (up to a max of 100) to be input by the user. After the data has been collected, your program should calculate and output the mean and median of the collected data, as well as the sorted grade information.

Design Constraints

  1. Use an integer constant of 100 to specify the number of elements in the array you will use to collect the grade information.
  2. Do not use any global variables in your program.
  3. Declare any arrays you need in your main function and pass the arrays as needed into the functions described below.
  4. The main function is the only function permitted to do any output to the console!!! Do not do cout operations inside of any other function.
  5. Your data collection loop in your main function must allow the user to enter less than 100 grades. It must also make sure that the user does not try to enter more than 100 grades.
  6. Each data value entered should be checked to make sure it is between 0 and 100. Any other value entered should be considered invalid and ignored (ie. not counted as a valid input and not stored in an array).
  7. Once the data is collected, the array and the number of grades collected must be passed to a function called mean.
  8. The mean function must loop through the values in the array, summing them together. The result of the function is the sum divided by the number of grades collected. The result must be returned from the mean function to the main function, where is it output in an appropriate manner (two digits after the decimal point).
  9. The main function should then pass the array and the number of grades collected to the median function.
  10. The median of a set of numbers is the number in the set where half the numbers are above it and half the numbers are below it. In order to find the median, this function will need to sort the original data.
  11. The simplest sorting procedure is called bubble sorting. The following pseudocode describes bubble sorting for Xvalid array elements.

for outer = 0; outer < X; outer++

for inner = 0; inner < X-1; inner++

if array[inner] > array[inner+1]

          swap(array[inner], array[inner+1]);

  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.
  2. The main routine should output the median value in an appropriate manner.
  3. The main routine should also output the sorted array with 5 grades per line.
  4. 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.
  5. 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.
  6. 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!

 

Reference no: EM13306873

Questions Cloud

Calculate the scattering angle : X-rays are scattered from electrons in a carbon target. The measured wavelength shift is 0.00099 nm. Calculate the scattering angle
Create queue class should have the following methods : create queue class should have the following methods:
Determine the image distance from the lens : A magnifying lens with a focal length of 5 cm is held 4 cm from an object that is 1cm tall. Find the image distance from the lens
What is the heat rejection for the condenser in btu per h : Consider a small simple Rankine Power cycle which produces 600kW power from an electric generator with an efficiency of 95%. The steam leaves the boiler at 1250psia as superheated steam and leaves the turbine at 2 psia with a quality of 90%.
Calculate and output the mean and median of collected data : Design a program that will allow some number of grades (up to a max of 100) to be input by the user. After the data has been collected, your program should calculate and output the mean and median of the collected data, as well as the sorted grade..
Store the quotient in a word-size variable called result : Show how to perform 77 / 3 in the HCS12. Store the quotient in a WORD-size variable called result, and the remainder in a WORD-size variable called remainder.
Obtain the value of the resistor : A 120 V rms voltage at 60 Hz is applied across a 10 uF capacitor and an unknown resistor. what is the value of the resistor
Draw the uml diagram and implement : Draw the UML diagram and implement the new GeometricObject class. Write a test program that uses the max method to find the larger of two circles and the larger of two rectangles.
Determine the average velocity in the diameter pipe : If the average velocities in the 0.15 m and 0.2 m diameter pipes are 2 m/s and 3 m/s respectively, then find the average velocity in the 0.3 m diameter pipe

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Explaining notifier sends e-mail to system administrator

Suppose a notifier sends e-mail to the system administrator when a successful compromise of that system is detected. What are the drawbacks of this approach?

  Write a python function celcius fahrenheit

Write a python function celcius_fahrenheit wich takes temperature values from a list and changes them into fahrenheit values.

  What is the decimal value

assume that the following 10 bit numbers represents sighned integers using sign/magnitude notation. the sign is the leftmost bit and the remaining 9 bits represent the magnitude. What is the decimal value for 100000000.

  Intelligent systems for health maintenance organization

Aacquiring a company in the health maintenance organization (HMO) field. DSS, ES, ESS, or intelligent systems can be used in such a situation.

  How many bit comparisons are made

How many bit comparisons (both successful and unsuccessful) are made by the brute-force string-matching algorithm in searching for the pattern 11001 in a binary text of 500 ones?

  Write a complete main method that would print your last name

Suppose your name was George Gershwin. Write a complete main method that would print your last name, followed by a comma, followed by a space and your first name. Question 2 Declare a variable named myMenu suitable for holding references to Menu o..

  Write a program that reads in an integer value

Write a program that reads in an integer value for n and then sums the integers from n to 2*n if n is nonnegative, or from 2*n to n if n is negative. Write the code in two versions: one using only for loops and the other using only while loops.

  Four consecutive clock pulses

A given FSM has an input w, and an output,z. During four consecutive clock pulses, a sequence of four values of the w is applied. Derive a state table for the FSM that produces z = 1 when it detects that either the sequence w: 0101 or w: 0111 has bee..

  How a virtual address in this machine is translated

how a virtual address in this machine is translated into a physical address, assuming that the MMU has an 8-entry fully associative TLB. Label all lines and show how many bits are in each part.

  Ipo chart and pseudocode

Start by analyzing the problem; use an IPO chart and pseudocode (or flowchart) to brainstorm the logic prior to start coding. Using Visual Studio code and test your program according to your pseudocode solution. Once you are satisfied with your progr..

  What would be the best choice of the degree

A B+ - tree index is to be built on the name attribute of the relation student. Assume that all the student names are o length 8bytes, disk blocks are of size 512 bytes , and index pointer are of size 4bytes. Given this scenariom, what would be th..

  How the game is played from start to finish

Conduct outside research on the game Yahtzee. You really want to better understand how the game is played and scored. Then, create a 1-2 page paper that explains the following in essay form:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd