title: How to Create a java program of computing student grades
body: <p>I was asked to create a java OOP program with the following specifications:</p>
  
  <blockquote>
    <p>Student Grade                  Name : String                 Id :
    String                   math grade : double           english grade :
    double         science grade : double                   Average () :
    double                            printInfo () : void</p>
  </blockquote>
  
  <p>The Instructions are: </p>
  
  <blockquote>
    <p>1)Create Student Grade Class</p>
    
    <p>2)Create an Array of 10 Student</p>
    
    <p>3) Enter Grade info using Keyboard</p>
    
    <p>4) Print list of students (name and average)</p>
  </blockquote>
  
  <p>My problem is every time I run the public class <code>StudentGradeApp2</code> it always gives me this error </p>
  
  <blockquote>
  <pre><code> Exception in thread "main" java.lang.NullPointerException
    at javaDay3.StudentGradeApp2.main(StudentGradeApp2.java:15)
  </code></pre>
  </blockquote>
  
  <p>Now i do not know what to put on this portion:</p>
  
  <pre><code>public static void printTheStudentDetails (StudentGrade info) {
  </code></pre>
  
  <p>please oh please help me</p>
  
  <p>My codes are: 
  <code>StudentGrade</code> Class:</p>
  
  <pre><code>    package javaDay3;
  
      public class StudentGrade {
  
              String name;
              String id;
              double mathgrade;
              double enggrade;
              double scigrade;
  
              public void printInfo() {
                  System.out.println("Math = " + mathgrade);
                  System.out.println("English = " + enggrade);
                  System.out.println("Science = " + scigrade);
                  System.out.println( "Average = " + average());
          }
          public double average () {
              return ((mathgrade + enggrade + scigrade) / 3);
      }
          public void printCompleteInformation() {
              System.out.println("Name = " + name);
              System.out.println("ID = " + id);
              System.out.println("Math = " + mathgrade);
              System.out.println("English = " + enggrade);
              System.out.println("Science = " + scigrade);
              System.out.println( "Average = " + average());
          }
          public void printNeed () {
              System.out.println("Name = " + name);
              System.out.println( "Average = " + average());
          }   
      }
  </code></pre>
  
  <p>StudentGradeApp Class:     </p>
  
  <pre><code>    package javaDay3;
  
      import java.util.Scanner;
  
      public class StudentGradeApp {
  
          public static void main(String[] args) {
              // TODO Auto-generated method stub
  
              StudentGrade stud1 = new StudentGrade ();
              stud1.name = "SpongeBop SquarePants";
              stud1.id = ("Student 1");
              stud1.mathgrade = 72;
              stud1.enggrade = 80;
              stud1.scigrade = 90;
              stud1.average();
  
              StudentGrade stud2 = new StudentGrade ();
              stud2.name = "Patrick Star";
              stud2.id = ("Student 2 ");
              stud2.mathgrade = 72;
              stud2.enggrade = 85;
              stud2.scigrade = 91;
              stud2.average();
  
              StudentGrade stud3 = new StudentGrade ();
              stud3.name = "Squidward Tentacles";
              stud3.id = ("Student 3" );
              stud3.mathgrade = 90;
              stud3.enggrade = 85;
              stud3.scigrade = 95;
              stud2.average();
  
              StudentGrade stud4 = new StudentGrade ();
              stud4.name = "Eugene H. Krabs";
              stud4.id = ("Student 4");
              stud4.mathgrade = 95;
              stud4.enggrade = 85;
              stud4.scigrade = 95;
              stud4.average();
  
              StudentGrade stud5 = new StudentGrade ();
              stud5.name = "Sandy Cheeks";
              stud5.id = ("Student 5");
              stud5.mathgrade = 75;
              stud5.enggrade = 75;
              stud5.scigrade = 95;
              stud5.average();
  
              StudentGrade stud6 = new StudentGrade ();
              stud6.name = "Gary the Snail";
              stud6.id = ("Student 6");
              stud6.mathgrade = 75;
              stud6.enggrade = 74;
              stud6.scigrade = 95;
              stud6.average();
  
              StudentGrade stud7 = new StudentGrade ();
              stud7.name = "Sheldon J Plankton";
              stud7.id = ("Student 7 ");
              stud7.mathgrade = 79;
              stud7.enggrade = 76;
              stud7.scigrade = 75;
              stud7.average();
  
              StudentGrade stud8 = new StudentGrade ();
              stud8.name = "Larry The Lobster";
              stud8.id = ("Student 8");
              stud8.mathgrade = 79;
              stud8.enggrade = 76;
              stud8.scigrade = 75;
              stud8.average();
  
              StudentGrade stud9 = new StudentGrade ();
              stud9.name = "King Neptune";
              stud9.id = ("Student 9 ");
              stud9.mathgrade = 79;
              stud9.enggrade = 96;
              stud9.scigrade = 75;
              stud9.average();
  
              StudentGrade stud10 = new StudentGrade ();
              stud10.name = "Pearl Krabs";
              stud10.id = ("Student 10 ");
              stud10.mathgrade = 79;
              stud10.enggrade = 76;
              stud10.scigrade = 75;
              stud10.average();
  
              /*stud1.printInfo();
              System.out.println(" ");
              stud2.printInfo();
              System.out.println(" ");
              stud3.printInfo();
              System.out.println(" ");
              stud4.printInfo();
              System.out.println(" ");
              stud5.printInfo();
              System.out.println(" ");
              stud3.printInfo();
              System.out.println(" ");
              stud6.printInfo();
              System.out.println(" ");
              stud7.printInfo();
              System.out.println(" ");
              stud8.printInfo();
              System.out.println(" ");
              stud9.printInfo();
              System.out.println(" ");
               stud10.printInfo(); */
          }
          public static void printTheStudentDetails (StudentGrade info) {
      }
      }
  </code></pre>
  
  <p><code>StudentGradeApp2</code> Class:</p>
  
  <pre><code>    import java.util.Scanner;
  
      public class StudentGradeApp2 {
  
          public static void main(String[] args) {
              // TODO Auto-generated method stub
              StudentGrade studgrad [] = new StudentGrade [10];
  
              Scanner scanner = new Scanner (System.in);
              for(int i = 0; i &lt;= studgrad.length; i++) {
  
                  System.out.print("Enter Math Grade = ");
                  studgrad[i].mathgrade = scanner.nextInt();
  
                  System.out.print("Enter English Grade = ");
                  studgrad[i].enggrade = scanner.nextInt();
  
                  System.out.print("Enter Science Grade = ");
                  studgrad[i].scigrade = scanner.nextInt();
  
          }
              for(StudentGrade info:studgrad)
                  info.printInfo();
                  scanner.close();
      }
      }
  </code></pre>