title: Stuck on Java program that tallies grades and shows results
body: <p>I'm taking a beginners course in Java and they asked us to: </p>
  
  <ul>
  <li><p>Write a program to tally the number of A's, B's, C's, D's and F's based upon a list of scores entered by a user.</p></li>
  <li><p>After all the scores are entered, the program must display a
  horizontal bar graph of the number tallied for each grade like that shown in the Operation section.</p></li>
  <li><p>The tally graph must display a single '*' for each unit tallied.</p></li>
  <li><p>When a user enters a -1, the program must display the final graph and
  exit.</p></li>
  <li><p>The output of your program must display prompts and a tally graph
  like that shown in the Operation section above.</p></li>
  <li><p>You may assume that a user will enter numbers only.</p></li>
  </ul>
  
  <p>Operation:</p>
  
  <p>The program starts and prompts you to either enter a test score or end
  the program by entering a -1. Like the following:</p>
  
  <pre><code>Number of A's: 0
  Number of B's: 0
  Number of C's: 0
  Number of D's: 0
  Number of F's: 0
  Enter a score (%) or -1 to end: 90
  </code></pre>
  
  <p>As you enter each score, the application decides whether the score is
  an A, B, C, D or F and adds one to the letter-grade tally. Like the
  following:</p>
  
  <pre><code>Number of A's: 1
  Number of B's: 0
  Number of C's: 0
  Number of D's: 0
  Number of F's: 0
  Enter a score (%) or -1 to end: 95
  </code></pre>
  
  <p>Each time you enter a score, the program updates the tally. Like the following:</p>
  
  <pre><code>Number of A's: 2
  Number of B's: 0
  Number of C's: 0
  Number of D's: 0
  Number of F's: 0
  Enter a score (%) or -1 to end: -1
  </code></pre>
  
  <p>When you are done entering scores, the program displays a horizontal
  bar graph of the tally for A's, B's, C's, D's and F's. Like the
  following:</p>
  
  <pre><code>A's: **
  B's:
  C's:
  D's:
  F's:
  </code></pre>
  
  <p>Specifications:</p>
  
  <p>Numerical Grade                             Letter Grade </p>
  
  <p>greater than or equal to 90                      A </p>
  
  <p>less than 90 but greater than or equal to 80     B </p>
  
  <p>less than 80 but greater than or equal to 70     C </p>
  
  <p>less than 70 but greater than or equal to 60     D </p>
  
  <p>less than 60                                     F </p>
  
  <p>When the program ends, display the number of scores, average score, and best score.</p>
  
  <p>Example:</p>
  
  <p>Number of scores:  2</p>
  
  <p>Average score: 92.5</p>
  
  <p>Best score: 95.0</p>
  
  <p>We have also been instructed to code in at least two methods : one that has a void and one that returns something.</p>
  
  <p>So far I have only been able to tally up the scores entered, but I don't seem to be able to wrap my head around <em>recording all the inputs</em> and <em>calculating the average</em> and <em>picking out the best score</em></p>
  
  <p>This is what I have so far :</p>
  
  <pre><code>    import java.util.*;
  
  
      public class ScoreTally {
          public static void main(String[] args) {
               Scanner input = new Scanner(System.in);
  
  
              int aCount = 0;
              int bCount = 0;
              int cCount = 0;
              int dCount = 0;
              int fCount = 0;
              int scoreCount = -1;
  
              double score = 0;
  
  
  
              while (score != -1) {
                  if (score &gt;= 90)
                      aCount++;
  
                  else if ((score &lt; 90) &amp;&amp; (score &gt;= 80))
                      bCount++;
  
                   else if ((score &lt; 80) &amp;&amp; (score &gt;= 70))
                      cCount++;
  
                  else if ((score &lt; 70) &amp;&amp; (score &gt;= 60))
                      dCount++;
  
                  else if ((score &lt; 60) &amp;&amp; (score &gt; 0))
                      fCount++;
  
                  System.out.println("Number of A's: " + aCount);
                  System.out.println("Number of B's: " + bCount);
                  System.out.println("Number of C's: " + cCount);
                  System.out.println("Number of D's: " + dCount);
                  System.out.println("Number of F's: " + fCount);
                  System.out.print("Enter a score (%) or -1 to end: ");
                  score = input.nextDouble();
  
                  scoreCount++;
  
              }
  
              if (score == -1)
                  System.out.println("Number of scores: " + scoreCount);
  
          }
      }
  </code></pre>