title: Minimum, Maximum, and average of grades
body: <p>I am trying to write a program that takes in grade numbers and returns the letter grade, and after the user enters -1 it returns the maximum grade, minimum grade, and the average grade that was entered. Right now, the program returns the letter grade and zero for the Average, maximum, and, minimum.</p>
  
  <pre><code>import java.util.Scanner;
  
  public class getLetterGrade {
      public static void main(String[] args) {
          int count = getGrades();
          int sum = getGrades();
          int max =  getGrades();
          int min =  getGrades();
          System.out.println("You entered " + count + " students");
          System.out.println("Class average =" + sum / count);
          System.out.println("Maximum =" + max);
          System.out.println("Minimum ="+ min);
  
      }
  
      public static int getGrades() {
          Scanner reader = new Scanner(System.in); {
          int count = 0;
          int sum = 0;
          int min = 100;
          int max = 0;
  
          while(true) {
              System.out.println("Welcome to the grade calculator. \n Please enter a numeric grade. \n After the last student in the class, enter a grade of -1.");
  
  
              int grade = reader.nextInt();
  
  
  
              if (grade &gt;= 90) {
                  System.out.println("That's an A");
              } else if (grade &gt;= 80 ) {
                  System.out.println("That's a B");
              } else if (grade &gt;= 70) {
                  System.out.println("That's a C");
              } else if (grade &gt;= 60) {
                  System.out.println("That's a D");
              } else if (grade &gt;= 0) {
                  System.out.println("That's an F");
              } else if (grade == -1) {
                  return count; 
              }
  
              if (grade &lt; min){
                min = grade;
              }
              if (grade &gt; max){
                max = grade;}
  
              count++;
              sum += grade;
  
          }
      }
  }
  }
  </code></pre>