// This program reads in the number of votes obtained by each
// candidate in an election.  It then outputs the average of the
// number of votes obtained by the candidates.
// Barry Cornelius, 3 June 2000
import java.io. BufferedReader;
import java.io. InputStreamReader;
import java.io. IOException;
public class AvSimple
{
   public static void main(final String[] pArgs) throws IOException
   {
      final BufferedReader tKeyboard =
                    new BufferedReader(new InputStreamReader(System.in));
      System.out.print("How many candidates are there? ");
      System.out.flush();
      String tLine = tKeyboard.readLine();
      final int tNumberOfCandidates = Integer.parseInt(tLine);
      int tTotalVotes = 0;
      for (int tCandidateNumber = 1;
               tCandidateNumber<=tNumberOfCandidates; tCandidateNumber++) 
      {
         System.out.println("Candidate number: " + tCandidateNumber);
         System.out.print("Type in number of votes for this candidate: ");
         System.out.flush();
         tLine = tKeyboard.readLine();
         final int tNumberOfVotes = Integer.parseInt(tLine);
         tTotalVotes += tNumberOfVotes;
      }
      final double tAverage = (double)tTotalVotes/tNumberOfCandidates;
      System.out.println("Average number of votes scored is: " + tAverage);
   }
}
