#include <iostream> #include <cmath> using namespace std; //Display functions vo
ID: 3618765 • Letter: #
Question
#include <iostream>
#include <cmath>
using namespace std;
//Display functions
void calculateMean(double, double);
void calculateStandardDeviation(double,double, double);
void getLetterGrade(double, double,double);
//enter main function
int main()
{
//Declare variables
doublescore, count, totalScores = 0.0, mean = 0.0, standardDeviation =0.0;
//askuser how many scores user wishes to enter
cout<< "How many scores do you wish to enter? ";
cin>> count;
//forloop statement to enter all the scores from the amount the userwishes to enter
for(double num = 1.0; num <= count; num++)
{
cout << "Enter score " << num << ": ";
cin >> score;
//Calculate the total of the scores
totalScores = totalScores + score;
}
//Function to calculateMean()
calculateMean(count, totalScores);
//Function to calculateStandardDeviation()
calculateStandardDeviation(count, mean, totalScores);
//Function to getLetterGrade()
getLetterGrade(mean, standardDeviation, score);
//return a value
return0;
}
//calculate Mean function
void calculateMean(double numberScores,double totalScores)
{
//Declare variables
doublemean;
//Calculate the mean
mean =(1.0 / numberScores) * totalScores;
//Display the mean
cout<< "The mean of the scores is " << mean <<endl;
}
//calculateStandardDeviation() function
void calculateStandardDeviation(double mean,double count, double totalScores)
{
//Declare variables
doublestandardDeviation;
//Calculate the standard Deviation
cout<< fixed;
standardDeviation = sqrt (((pow(totalScores, 2.0)) - ((1.0/count) *(pow(totalScores,2.0)))) / (count - 1.0));
cout<< fixed << "The standard deviation of the scores is "<< standardDeviation << endl;
}
//Determine the letterGrade() function
void getLetterGrade(double mean, doublestandardDeviation, double score)
{
if(mean + (3/2 * standardDeviation) <= score)
{
cout << "This score is an A.";
}
else if(mean + (1/2 * standardDeviation) <= score < mean + (3/2 *standardDeviation))
{
cout << "This score is a B.";
}
else if(mean - (1/2 * standardDeviation) <= score < mean + (1/2 *standardDeviation))
{
cout << "This score is a C.";
}
else if(mean - (3/2 * standardDeviation) <= score < mean - (1/2 *standardDeviation))
{
cout << "Score is a D.";
}
else if(score < mean - (3/2 * standardDeviation))
{
cout << "Score is a F.";
}
else
{
cout << "Score is incomplete.";
}
}
Explanation / Answer
I have a deadline in 30 minutes...does anyone have any ideas willrate life savior
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.