hi I'm a student at Penn State and am having trouble with a major project that's due in two days. Any help would be greatly GREATLY appreciated. here is the instructions copied from the writeup of the project:
Goals: Developing problem-solving skills, using loops and functions
Problem: You have been asked to write a program that will help keep score for a gymnastics competition. There are seven judges who will report a score between 0 and 10 inclusively. You will need to calculate the average score after dropping the highest and lowest score. Your program will employ use 4 functions other than main.
The first functions should be a void function that will accept two values, a score and a number of the judge, ask the user to enter the score for this judge, robustly confirm that the score is valid, then send the correct score back to main. This function will be called seven times from main (once for each judge).
Another function will determine the minimum score. This function will accept 7 score values, determine the minimum of the 7 values, and return the minimum value to the function call. This function should be called from the function to calculate the average.
Another function will determine the maximum score. This function will accept 7 score values, determine the maximum of the 7 values, and return the maximum value to the function call. This function should be called from the function to calculate the average.
The fourth function should calculate the average score for the gymnast. This function should accept 7 scores, call the function to determine the minimum score, call the function to determine the maximum score, calculate the average score without the minimum and maximum vales, and return the average. This function will be called from main.
The main function should prompt the user to enter the name of the gymnast (use a string object), call the appropriate functions and output the name of the gymnast and the average score for the gymnast.
Do not use concepts beyond Chapter 6 of your text book. Do not use any system commands. Remember that your introductory comments should describe the problem without reference to any material outside the program. Plus you should have comments that appear immediately before each function that describes the purpose, input, processing and output for that function. Upload your source code to the drop box on ANGEL.
and here is the code of what I have so far:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
/*
jake lemay
block 004
this program will keep score for a gymnastics competition
input: score, name
output: average, name
processing:
*/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
void score();
void minimum(int);
void maximum(int);
void avg(int);
int main(int average)
{
string name;
cout << "please enter the name of the gymnast: ";
getline(cin, name);
cout << name << " recieved an average score of " << average << ".";
}
void score()
{
int score;
int count;
for (count = 1; count < 7; count++)
{
cout << "please enter the score given by the judge " << count << ": ";
cin >> score;
while (score > 10 && score < 0)
{
cout << "please enter a score between 0 and 10: ";
cin >> score;
}
minimum(score);
}
}
void minimum(int score)
{
int min;
int count;
for (count = 1; count < 7; count++)
{
if (score1 > score2)
{
score2 = min;
}
else if (score2 > score1)
{
score1 = min;
}
avg(min);
}
}
void maximum(int score)
{
int max;
int count;
for (count = 1; count < 7; count++)
{
if (score1 > score2)
{
score1 = max;
}
else if (score2 > score1)
{
score2 = max;
}
avg(max);
}
}
void avg(int min, int max)
{
int average;
int min;
int max;
average = (max + min) / 2;
main(average);
}
|