PLEASE USE FUNCTIONS TEMPLATE PROVIDED AND WORK ONLY ON THE \"TODO\". DO NOT DEL
ID: 3598510 • Letter: P
Question
PLEASE USE FUNCTIONS TEMPLATE PROVIDED AND WORK ONLY ON THE "TODO". DO NOT DELETE ANY CODE. Harish T. please do not answer this question.
home / study / engineering / computer science / computer science questions and answers / please use functions template provided and work on "todo" /*functions.cpp*/ #include #include ...
Question: PLEASE USE FUNCTIONS TEMPLATE PROVIDED AND WORK ON "TODO" /*functions.cpp*/ #include #include #in...
(2 bookmarks)
/*functions.cpp*/
#include
#include
#include
#include
#include
using namespace std;
//
// InputData()
//
// Given an input file of the following format:
//
// uin exam1 exam2 exam3
// uin exam1 exam2 exam3
// .
// .
// .
// -1 -1 -1 -1
//
// Inputs the data and stores the exam1 scores into array exam1,
// exam2 scores into array exam2, and exam3 scores into array
// exam3. The uins are discarded. The function returns the #
// of students N that were input and stored into the arrays.
//
int InputData(string filename, int exam1[], int exam2[], int exam3[])
{
//
// 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;
}
Explanation / Answer
package com;
public class ArraySortedPolynomial implements PolynomialInterface
{
ArraySortedPolynomial()
{
}
ArraySortedPolynomial(String pol)
{
}
@Override
public PolynomialInterface add(PolynomialInterface other) {
// TODO Auto-generated method stub
return null;
}
@Override
public PolynomialInterface subtract(PolynomialInterface other) {
// TODO Auto-generated method stub
return null;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.