A survey was taken by the student representatives, Each response is a number from 1 to 9.
The program computes the mean and mode of the data.
100 responses:
6, 7, 8, 9, 8, 7, 8, 9, 7, 8, 9, 8, 9, 8, 9, 5, 9, 8, 7, 8, 7, 8, 6, 7, 8,
9, 3, 9, 8, 7, 8, 9, 9, 8, 9, 8, 9, 8, 9, 7, 8, 9, 6, 7, 8, 7, 8, 7, 9, 7,
6, 5, 3, 5, 6, 7, 2, 5, 3, 9, 4, 6, 4, 7, 8, 9, 6, 8, 7, 8, 9, 7, 8, 7, 4,
4, 3, 6, 4, 6, 7, 5, 6, 4, 5, 6, 1, 6, 5, 7, 8, 5, 3, 6, 3, 5, 7, 5, 8, 9
- Initialize a single dimensional array with the data
- Create Frequency Table
- Summarize the information in a table
- Generate a histogram representing the frequency of each response 1 to 9
- Calculate the mean of the data
- Identify the mode and median of the data
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references.
Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.
#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
void sort(int responses[], int size);
void createFrequencyTable(int responses[], size_t size,
size_t ft[], size_t ftSize);
void summarize(size_t ft[], size_t ftSize);
void histogram(size_t ft[], size_t ftSize);
double mean(int responses[], size_t size);
int mode(size_t ft[], size_t ftSize);
double median(int responses[], size_t size);
int main()
{
// Initialize a single dimensional array with the data
int responses[100] =
{
6, 7, 8, 9, 8, 7, 8, 9, 7, 8, 9, 8, 9, 8, 9, 5, 9, 8, 7, 8, 7, 8, 6, 7, 8,
9, 3, 9, 8, 7, 8, 9, 9, 8, 9, 8, 9, 8, 9, 7, 8, 9, 6, 7, 8, 7, 8, 7, 9, 7,
6, 5, 3, 5, 6, 7, 2, 5, 3, 9, 4, 6, 4, 7, 8, 9, 6, 8, 7, 8, 9, 7, 8, 7, 4,
4, 3, 6, 4, 6, 7, 5, 6, 4, 5, 6, 1, 6, 5, 7, 8, 5, 3, 6, 3, 5, 7, 5, 8, 9
};
// init all sizes
int size = 100;
size_t ftSize = 10;
// sort the array, it's for median finding
sort(responses, size);
// Create Frequency Table
size_t ft[10];
createFrequencyTable(responses, size, ft, ftSize);
This is only a preview of the solution.
Please use the purchase button to see the entire solution.
By purchasing this solution you'll be able to access the following files: