Ok, i have been working on this program for a LONG time and i need some major help with the main.cpp file PLEASE.
I have to design a function that Designs and implements a function void getJudgeData() that asks the user for a judge's score, stores it in a reference parameter variable, and validates it. This function should be called by your function main() once for each of the 5 judges.

I dont get the reference parameter... Could anyone please please help me out i turned in the .cpp and .h files already and he said to not modify it anymore that it is good. To only work on the main.cpp and i need major help with the void getJudgeData part.


Main.cpp file

#include <iostream>
#include "Stat.h"

using namespace std;

void getJudgeData();
double calcScore();


int main()
{
    Stat s;

	cout << "This program assignment number 4 was created by Jeremy Rice" << endl;
	cout<<  "The Next American Idol!!!"<<endl;
    cout<< "Please enter your scores below!"<<endl; 

// asking for the scores from each judge
//using the function getJudgeData
cout<<"Judge #1 ";
getJudgeData();
cout<<"Judge #2 ";
getJudgeData();
cout<<"Judge #3 ";
getJudgeData();
cout<<"Judge #4 ";
getJudgeData();
cout<<"Judge #5 ";
getJudgeData();


system("pause");
	return 0;
}

void getJudgeData()
{
     Stat s;
    s.getNum("Please enter your score ");
  
 
}

double calcScore()
{
       Stat s;
       s.getAverage= (s.getSum - s.getMin - s.getMax)/3;
}

the idol.cpp file

#include <iostream> // for cin, cout
#include "Stat.h"

using namespace std;

Stat::Stat(  ){
    reset( );
}

void Stat::setNum ( int newNum ){
    thenum = newNum;
//  update data members
    if( count==0 ) // first integer entered
        min = max = thenum;
    count++;
    sum  = sum+thenum;
    prod = prod*thenum;
    if( thenum<min )
        min = thenum;
    if( thenum>max )
        max = thenum;
    if( thenum%2==0 )
        evens++;
    else
        odds++;
}

void Stat::getNum ( string prompt ){
    int someInt;
    cout << prompt;
    cin  >> someInt;
    setNum( someInt );
}

void Stat::reset (  ){
    count = 0;
    sum   = 0;
    prod  = 1;
    evens = 0;
    odds  = 0;
}

int Stat::getNum (  ){
    return thenum;
}

unsigned Stat::getCount (  ){
    return count;
}

int Stat::getSum (  ){
    return sum;
}

long Stat::getProd (  ){
    return prod;
}

int Stat::getMin (  ){
    return min;
}

int Stat::getMax (  ){
    return max;
}

float Stat::getAverage (  ){
    return (1.0 * sum) / count;
}

unsigned Stat::getEvens (  ){
    return evens;
}

unsigned Stat::getOdds (  ){
    return odds;
}

and the header file

// FILENAME:        Stat.h
//
// CLASS PROVIDED:  Stat

#ifndef STAT_H
#define STAT_H

#include <string>

using namespace std;

class Stat {

  // ATTRIBUTES /////////////////////////////////////////////////////////

  private:
     int      thenum; // last integer entered
     unsigned count;  // number of integers entered so far
     int      sum;    // sum of all integers entered so far
     long     prod;   // product of all integers entered so far
     int      min;    // minimum of all integers entered so far
     int      max;    // maximum of all integers entered so far
     unsigned evens;  // count of evens of all integers entered so far
     unsigned odds;   // count of odds  of all integers entered so far

  // OPERATIONS /////////////////////////////////////////////////////////

  public:
     Stat( );
  // - default constructor
     void setNum ( int newNum );
  // - sets the last integer entered to newNum
     void getNum ( string prompt );
  // - displays prompt and reads in another integer
     void reset (  );
  // - resets all statistical values
     int getNum (  );
  // - returns the last integer entered
     unsigned getCount (  );
  // - returns the number of integers entered so far
     int getSum (  );
  // - returns the sum of all integers entered so far
     long getProd (  );
  // - returns the product of all integers entered so far
     int getMin (  );
  // - returns the minimum of all integers entered so far
     int getMax (  );
  // - returns the maximum of all integers entered so far
     float getAverage (  );
  // - returns the average of all integers entered so far
     unsigned getEvens (  );
  // - returns the number of even integers entered so far
     unsigned getOdds (  );
  // - returns the number of odd integers entered so far

};

#endif

Good day. A few points for you:
1.You need to declare a score variable and reference that in your function.
2.You need to be declaring a Stat in your main.
3.You will need a loop that will repeat your main untill a 'y' is entered in the final user input(cin).

This article has been dead for over six months. Start a new discussion instead.