Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Summary: write a complete C++ program to anaylize student exam scores. All info

ID: 3599196 • Letter: S

Question

Summary: write a complete C++ program to anaylize student exam scores. All info showed below.

https://www.dropbox.com/sh/w9z77hqqwxv6s6h/AAArwsJaWVnyHEgRJfy7MwlAa?dl=0

/*main.cpp*/

#include
#include
#include
#include
#include

using namespace std;

//
// function declarations:
//
int InputData(string filename, int test1[], int test2[], int test3[]);
void Sort(int A[], int N);
double ComputeAvg(int A[], int N);
double ComputeMedian(int A[], int N);
double StandardDev(int A[], int N);
void Histogram(int A[], int N, int histogram[]);


//
// main:
//
int main()
{
int test1[1000];
int test2[1000];
int test3[1000];
int N;
string filename;

//
// input filename from keyboard:
//
cin >> filename;

//
// Input data and perform analysis:
//
cout << "** Test Analysis **" << endl;
cout << "Filename: " << filename << endl;

N = InputData(filename, test1, test2, test3);

cout << "Num Students: " << N << endl;

cout << "** Averages:" << endl;

cout << "** Medians:" << endl;

cout << "** Standard Deviations:" << endl;

cout << "** Histograms: A,B,C,D,F" << endl;

cout << "** Done **" << endl;

return 0;
}

/*functions.cpp*/

//
// Analysis functions: average, median, sort, histogram, etc.
//

#include
#include
#include
#include
#include

using namespace std;

//
// InputData()
//
// Given an input file of the following format:
//
// uin test1 test2 test3
// uin test1 test2 test3
// .
// .
// .
// -1 -1 -1 -1
//
// Inputs the data and stores the test1 scores into array test1,
// test2 scores into array test2, and test3 scores into array
// test3. The uins are discarded. The function returns the #
// of students N that were input and stored into the arrays.
//
int InputData(string filename, int test1[], int test2[], int test3[])
{
//
// TODO:
//

return -1;
}


//
// Sort()
//
// Sorts the given array of N integers into ascending order.
// Uses selection sort, which is fine for small values of N,
// N < 10,000.
//
// If you want to see different sorts "in action", here's a
// great web site for algorithm visualizations:
// http://www.sorting-algorithms.com/
//
void Sort(int A[], int N)
{
int indexOfMin;

//
// Selection sort: select the min element, move to front,
// repeat.
//
for (int i = 0; i < N - 1; i=i+1)
{
//
// find the min in range i..N, and then move min element
// to the front of range:
//
indexOfMin = i; // assume the first is the min:

for (int j = i + 1; j < N; j=j+1) // look for a smaller one:
{
if (A[j] < A[indexOfMin])
{
indexOfMin = j;
}
}

//
// we have index of min element, swap with first element so
// that we have sorted one element to the front:
//
if (indexOfMin != i) // swap:
{
int T = A[i];
A[i] = A[indexOfMin];
A[indexOfMin] = T;
}
}//for

//
// A is now sorted:
//
return;
}


//
// ComputeAvg()
//
// Returns the average of N integers in array A; it
// is assumed that N > 0.
//
double ComputeAvg(int A[], int N)
{
//
// TODO:
//

return -1;
}


//
// ComputeMedian()
//
// Given an array A of N integers in sorted order, returns
// the median value. If N is even, the median is the avg
// of the middle values.
//
double ComputeMedian(int A[], int N)
{  
//
// TODO:
//

return -1;
}


//
// StandardDev()
//
// Given an array A containing N real numbers, computes and returns
// the population standard deviation. The function should not change
// the contents of the array.
//
double StandardDev(int A[], int N)
{
//
// TODO:
//

return -1;
}


//
// Histogram()
//
// Given an array of N scores, computes the # of A's, B's,
// C's, D's, and F's. Definition of letter grades follows
// the standard 90-80-70-60:
//
// A: 90..100
// B: 80..89
// C: 70..79
// D: 60..69
// F: 0..59
//
// The histogram is returned via the 3rd parameter "hist".
// This parameter is assumed to be of size 5. The # of A's
// will be hist[0], B's [1], C's [2], D's [3], and F's [4].
//
void Histogram(int A[], int N, int hist[])
{
//
// TODO:
//

return;
}

Summary: write complete C++program to analysis student exam scores In class weve discussed using arrays to store exam scores for a class, and writing functions to input the data, compute the median, etc. And in lab this week you wrote a function to compute standard deviation. We're going to put all these pieces together to write a program that analyzes a set of 3 exams across a semester The input file will consist of 4 columns: last 4 digits of UIN, exam 1, exam 2, and exam 3. The end of the file will be marked by -1-1-1-1 Here's an example (this is the first test case) 1234 80 81 82 2231 90 89 88 2561 100 12 12 3009 100 70 79 3754 60 59 70 4101 50 89 100 4202 10 20 30 5981 18 20 20 6299 30 30 28 7890 88 87 88 8171 100 80 90 9906 59 69 79

Explanation / Answer

Here are the TO DO tasks for you:

/*functions.cpp*/
//
// Analysis functions: average, median, sort, histogram, etc.
//
#include<iostream>
#include<iomanip>
#include<cmath>
#include<fstream>
//#include
using namespace std;
//
// InputData()
//
// Given an input file of the following format:
//
// uin test1 test2 test3
// uin test1 test2 test3
// .
// .
// .
// -1 -1 -1 -1
//
// Inputs the data and stores the test1 scores into array test1,
// test2 scores into array test2, and test3 scores into array
// test3. The uins are discarded. The function returns the #
// of students N that were input and stored into the arrays.
//
int InputData(string filename, int test1[], int test2[], int test3[])
{
//
// TODO:
//
int count = 0;
ifstream fin;
fin.open(filename);
int temp;
while(true)
{
    fin >> temp >> test1[count] >> test2[count] >> test3[count];
    if(test1[count] == -1 && test2[count] == -1 && test3[count] == -1)
        return count;
    count++;  
}
return -1;
}

//
// Sort()
//
// Sorts the given array of N integers into ascending order.
// Uses selection sort, which is fine for small values of N,
// N < 10,000.
//
// If you want to see different sorts "in action", here's a
// great web site for algorithm visualizations:
// http://www.sorting-algorithms.com/
//
void Sort(int A[], int N)
{
int indexOfMin;
//
// Selection sort: select the min element, move to front,
// repeat.
//
for (int i = 0; i < N - 1; i=i+1)
{
//
// find the min in range i..N, and then move min element
// to the front of range:
//
indexOfMin = i; // assume the first is the min:
for (int j = i + 1; j < N; j=j+1) // look for a smaller one:
{
if (A[j] < A[indexOfMin])
{
indexOfMin = j;
}
}
//
// we have index of min element, swap with first element so
// that we have sorted one element to the front:
//
if (indexOfMin != i) // swap:
{
int T = A[i];
A[i] = A[indexOfMin];
A[indexOfMin] = T;
}
}//for
//
// A is now sorted:
//
return;
}

//
// ComputeAvg()
//
// Returns the average of N integers in array A; it
// is assumed that N > 0.
//
double ComputeAvg(int A[], int N)
{
//
// TODO:
//
double avg = 0.0;
for(int i = 0; i < N; i++)
   avg += A[i];
return avg/N;
}

//
// ComputeMedian()
//
// Given an array A of N integers in sorted order, returns
// the median value. If N is even, the median is the avg
// of the middle values.
//
double ComputeMedian(int A[], int N)
{
//
// TODO:
//
if(N % 2 == 1)
   return A[N/2];
return (A[N/2] + A[N/2-1]) / 2.0;
}

//
// StandardDev()
//
// Given an array A containing N real numbers, computes and returns
// the population standard deviation. The function should not change
// the contents of the array.
//
double StandardDev(int A[], int N)
{
//
// TODO:
//
if(N == 0)
return 0;
double sum = 0;
//Calculates the sum of elements in the array.
for(int i = 0; i < N; i++)
sum += A[i];
//Calculates the mean of the array.
double mean = sum / N;
if(N == 0)
return 0;
sum = 0;
for(int i = 0; i < N; i++)
sum += pow((A[i]- mean), 2);
double std = sum / N;
std = sqrt(std);
return std;
return -1;
}

//
// Histogram()
//
// Given an array of N scores, computes the # of A's, B's,
// C's, D's, and F's. Definition of letter grades follows
// the standard 90-80-70-60:
//
// A: 90..100
// B: 80..89
// C: 70..79
// D: 60..69
// F: 0..59
//
// The histogram is returned via the 3rd parameter "hist".
// This parameter is assumed to be of size 5. The # of A's
// will be hist[0], B's [1], C's [2], D's [3], and F's [4].
//
void Histogram(int A[], int N, int hist[])
{
//
// TODO:
//
for(int i = 0; i < N; i++)
   if(A[i] >= 90)
       hist[0]++;
   else if(A[i] >= 80)
       hist[1]++;
   else if(A[i] >= 70)
       hist[2]++;
   else if(A[i] >= 60)
       hist[3]++;
   else
       hist[4]++;              
return;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote