Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views7 pages

Grade Checker Application

The Grade Checker Application is a Java Swing project that evaluates student performance based on scores, providing grades and remarks through a user-friendly interface. It features input fields for student name and score, and displays results after validation and calculation. The application is designed for Java 8 and later, utilizing a modern UI with dark and light contrasts for enhanced readability.

Uploaded by

raymondrog94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views7 pages

Grade Checker Application

The Grade Checker Application is a Java Swing project that evaluates student performance based on scores, providing grades and remarks through a user-friendly interface. It features input fields for student name and score, and displays results after validation and calculation. The application is designed for Java 8 and later, utilizing a modern UI with dark and light contrasts for enhanced readability.

Uploaded by

raymondrog94
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

GRADE CHECKER APPLICATION (JAVA GUI USING NETBEANS)

Introduction
This project is a user-friendly Java Swing application that evaluates student
performance based on scores. It provides an interface for entering the student's name
and score, and then displays the grade (A–F) along with a performance remark (e.g.,
Excellent, Fair, Fail).
Designed with a modern UI theme, the app uses dark and light contrasts for better
user experience and readability. It is built to work smoothly on Java 8 and later
versions.
How It Works
The GUI uses Java Swing components such as JFrame, JPanel, JTextField,
JTextArea, and JButton.
The interface contains:
Input for student name
Input for score (0–100)
Button to check the grade
Output area that shows the result
When the button is clicked, the app:
1. Reads and validates the score
2. Determines the grade and remark
3. Displays the result in the output area
GRADING CRITERIA
Score RangeGrade Remark
91 – 100 A Excellent
81 – 90 B Very Good
71 – 80 C Good
61 – 70 D Average
51 – 60 E Fair
41 – 50 Pass Pass
0 – 40 F Fail
PSEUDOCODE
Start Program
Create GUI window with:
- Input field for name
- Input field for score
- Button to check grade
- Output text area
ON BUTTON CLICK:
- Get name and score from user
- If input is empty, show error
- Convert score to number
- Check which range the score falls into:
91 - 100 => Grade A, Excellent
81 - 90 => Grade B, Very Good
71 - 80 => Grade C, Good
61 - 70 => Grade D, Average
51 - 60 => Grade E, Fair
41 - 50 => Pass, Pass
0 - 40 => Grade F, Fail
- Display the result in the output area
End Program
JAVA CODE
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class GradeCheckerGUI extends JFrame {
private JTextField nameField, scoreField;
private JTextArea resultArea;
public GradeCheckerGUI() {
// Frame setup
setTitle("Grade Checker");
setSize(450, 350);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
// Panel setup
JPanel panel = new JPanel();
panel.setBackground(Color.decode("#2F2F2F"));
panel.setLayout(null);

JLabel nameLabel = new JLabel("Student Name:");


nameLabel.setBounds(30, 30, 100, 25);
nameLabel.setForeground(Color.WHITE);
panel.add(nameLabel);
nameField = new JTextField();
nameField.setBounds(150, 30, 250, 30);
nameField.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1, true));
panel.add(nameField);
JLabel scoreLabel = new JLabel("Score (0 - 100):");
scoreLabel.setBounds(30, 80, 120, 25);
scoreLabel.setForeground(Color.WHITE);
panel.add(scoreLabel);
scoreField = new JTextField();
scoreField.setBounds(150, 80, 250, 30);
scoreField.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1, true));
panel.add(scoreField);
JButton checkButton = new JButton("Check Grade");
checkButton.setBounds(150, 130, 150, 35);
checkButton.setBackground(Color.WHITE);
checkButton.setForeground(Color.BLACK);
panel.add(checkButton);
resultArea = new JTextArea();
resultArea.setBounds(30, 180, 370, 100);
resultArea.setFont(new Font("Arial", Font.PLAIN, 14));
resultArea.setEditable(false);
resultArea.setLineWrap(true);
resultArea.setWrapStyleWord(true);
panel.add(resultArea);

checkButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkGrade();
}
});

add(panel);
setVisible(true);
}

private void checkGrade() {


String name = nameField.getText().trim();
String scoreText = scoreField.getText().trim();

if (name.isEmpty() || scoreText.isEmpty()) {
resultArea.setText("Please enter both name and score.");
return;
}

try {
int score = Integer.parseInt(scoreText);
String grade, remark;

if (score >= 91 && score <= 100) {


grade = "A";
remark = "Excellent";
} else if (score >= 81) {
grade = "B";
remark = "Very Good";
} else if (score >= 71) {
grade = "C";
remark = "Good";
} else if (score >= 61) {
grade = "D";
remark = "Average";
} else if (score >= 51) {
grade = "E";
remark = "Fair";
} else if (score >= 41) {
grade = "Pass";
remark = "Pass";
} else if (score >= 0) {
grade = "F";
remark = "Fail";
} else {
resultArea.setText("Score must be between 0 and 100.");
return;
}

resultArea.setText("Name: " + name + "\n" +


"Score: " + score + "\n" +
"Grade: " + grade + "\n" +
"Remark: " + remark);
} catch (NumberFormatException ex) {
resultArea.setText("Please enter a valid number for score.");
}
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> new GradeCheckerGUI());
}
}
CONCLUSION
This Java GUI project demonstrates how a simple grading system can be made
interactive and user-friendly using Swing. It checks a student's performance, assigns
grades and remarks, and displays results clearly. The program uses modular design
and input validation, and can be expanded to save or print results in the future.

You might also like