Java Student Grade System

Calculate student grades using arrays, loops, methods, and conditions.

TutorialsJava Projects › Java Student Grade System

Project Overview

Calculate student grades using arrays, loops, methods, and conditions.

This beginner Java project helps you practice real coding skills with a small program you can run, edit, and improve.

Java Code

public class StudentGrades {
  public static void main(String[] args) {
    int[] scores = {85, 90, 78, 92};
    int total = 0;
    for (int score : scores) {
      total += score;
    }
    double average = total / (double) scores.length;
    System.out.println("Average: " + average);
    if (average >= 90) System.out.println("Grade: A");
    else if (average >= 80) System.out.println("Grade: B");
    else System.out.println("Grade: C");
  }
}

How to Run This Project

  1. Install the Java JDK.
  2. Create a new file. Use the public class name as the file name.
  3. Paste the code into the file.
  4. Compile it using javac FileName.java.
  5. Run it using java FileName.

What You Practice

  • Java syntax
  • Variables and data types
  • Conditions and loops
  • Methods, classes, or objects depending on the project
  • Problem solving

Project Improvements

  • Add input validation.
  • Add better menus and messages.
  • Use classes and objects for better structure.
  • Save data to a file.
  • Convert the project into a GUI app later.

Related Java Lessons

Java Tutorial | Methods | Classes | Objects | Collections