0% found this document useful (0 votes)
8 views15 pages

Java Microproject2

java_microproject2

Uploaded by

itzmerehanop
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
8 views15 pages

Java Microproject2

java_microproject2

Uploaded by

itzmerehanop
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 15

Karmaveer Shankarrao Kale Education Society’s

GAUTAM POLYTECHNIC INSTITUTE GAUTAMNAGAR

CERTIFICATE
A PROJECT REPORT ON
“STUDENT GRADE CALCULATOR”

GROUP MEMBERS
1] SAYYED REHAN AMIN(2216690061)
2] RAYBHAN SAISH BALASHAEB (2216690058)
3] ABHALE ATHARVA VIJAY(22166900057)

UNDER THE GUIDENCE OF


Prof.Bharti M.B

Department of computer Engineering


Karmaveer Shankarrao Kale Education Society’s
GAUTAM POLYTECHNIC INSTITUTE GAUTAMNAGAR

CERTIFICATE
This is to certify that Mr. Abhale Atharva VIjay (2216690057)
Students of Second year of Diploma in Computer Engineering
have completed the micro project in assigned as per syllabus of “AJP(22517)”
satisfaction only for the academic year 2024-2025

Prof.Bharti M.B Prof. Bharti. M.B Prof. Bharti. S.M


Guide HOD Principal

Department of computer Engineering Year 2024-25


ACKNOWLEDGEMENT

Apart from the efforts of team, the success of any project depends largely on
the encouragement and guidelines of many others. We take this opportunity
to express our gratitude to the people who have been instrumental in the
successful completion of this project.
The completion of any inter-disciplinary project depends upon cooperation, co-
ordination and combined efforts of several sources of knowledge. We are
eternally grateful to our teacher Prof.Bharti M.B for his even willingness to give
us valuable advice and direction under which we executed this project.
His constant guidance and willingness to share his vast knowledge made us
understand this project and its manifestations in great depths and helped us to
complete the assigned tasks. We also acknowledge the endless contribution of
parents and friends who always encouraged us and support us their wistful
cooperation in our studies and help to complete our project within the limited
time frame helped us a lot.
INDEX

SR.NO CONTENT PAGE

1 ABSTRACT 5

2 INTRODUCTION 6

3 CODE 7-12

4 OUTPUT 13

5 CONCLUSION 14

6 REFERENCE 15
ABSTRACT
The given Java program is an implementation of a Student Grade Calculator
using the AWT (Abstract Window Toolkit) framework. The application creates a
graphical user interface (GUI) to allow students to input their marks for five
subjects: Advanced Java, CSS, Software Testing, Operating System, and EST. It
dynamically calculates the total marks, average score, and determines the
student's grade based on the calculated average.
The GUI layout is structured using a GridLayout consisting of labels and text
fields where the user can input the marks for each subject. The input fields
include validation to ensure that only valid numeric values are entered. If
invalid input is detected, such as non-numeric characters, a custom error
dialog is displayed to inform the user of the mistake.
The ActionListener interface is implemented to handle button events for
"Calculate" and "Clear." When the "Calculate" button is pressed, the program
retrieves the values from the text fields, computes the total and average of the
entered marks, and then assigns a grade based on predefined thresholds (A, B,
C, D, F). The grade assignment is based on the average score, with grade
boundaries specified (e.g., >= 90 for grade 'A'). The "Clear" button allows the
user to reset all input fields to their default state, making it easy to recalculate
grades for another set of marks.
Additionally, the application is designed to handle window events such as
closing the window by overriding the WindowAdapter methods. The text fields
for the total marks, average score, and grade are set to be non-editable to
prevent users from altering the calculated results.
This simple yet functional application demonstrates key concepts such as
event- driven programming, error handling, and GUI design in Java, making it a
useful tool for calculating student grades interactively.

Keywords: Java AWT, Student Grade Calculator, GUI, Event Handling,


ActionListener, GridLayout, Input Validation, Error Dialog, WindowAdapter.
INTRODUCTION

The Student Grade Calculator is a Java-based desktop application developed


using the AWT (Abstract Window Toolkit) framework. It provides a graphical
user interface (GUI) that allows users to input marks for five different subjects:
Advanced Java, CSS, Software Testing, Operating System, and EST. The program
calculates the total marks, the average score, and assigns a grade based on the
average.

Designed with simplicity and interactivity in mind, the application ensures ease
of use through a clean layout, featuring labeled text fields for input and
buttons for calculation and clearing. The program includes input validation to
handle incorrect data entries, offering helpful error messages when needed.
This interactive tool is especially useful for students and educators to quickly
and accurately compute grades based on predefined grading criteria, making it
an effective and educational utility.

Key concepts such as event handling, GUI design, and real-time calculations are
integrated into the program, showcasing practical usage of Java's AWT
components.
CODE
import java.awt.*;
import java.awt.event.*;

public class StudentGradeCalculatorAWT extends Frame implements


ActionListener {
private TextField tfAdvancedJava, tfCSS, tfSoftwareTesting, tfOperatingSystem,
tfEST, tfTotal, tfAverage, tfGrade;
private Button btnCalculate, btnClear;

public StudentGradeCalculatorAWT() {
setTitle("Student Grade
Calculator"); setSize(400, 400);
setLayout(new GridLayout(9, 2));

// Labels and text fields for subjects


add(new Label("Advanced Java:"));
tfAdvancedJava = new TextField();
add(tfAdvancedJava);

add(new Label("CSS:"));
tfCSS = new TextField();
add(tfCSS);

add(new Label("Software
Testing:")); tfSoftwareTesting = new
TextField(); add(tfSoftwareTesting);
add(new Label("Operating
System:")); tfOperatingSystem = new
TextField(); add(tfOperatingSystem);

add(new Label("EST:"));
tfEST = new TextField();
add(tfEST);

// Buttons for calculation and clearing


btnCalculate = new
Button("Calculate");
btnCalculate.addActionListener(this);
add(btnCalculate);

btnClear = new Button("Clear");


btnClear.addActionListener(e -> clearFields());
add(btnClear);

// Labels and text fields for Total, Average, and


Grade add(new Label("Total:"));
tfTotal = new TextField();
tfTotal.setEditable(false);
add(tfTotal);

add(new Label("Average:"));
tfAverage = new TextField();
tfAverage.setEditable(false);
add(tfAverage);

add(new
Label("Grade:")); tfGrade
= new TextField();
tfGrade.setEditable(false);
add(tfGrade);

// Closing the window


addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
dispose();
}
});
}

@Override
public void actionPerformed(ActionEvent e) {
try {
// Parsing the inputs
double advancedJava = Double.parseDouble(tfAdvancedJava.getText());
double css = Double.parseDouble(tfCSS.getText());
double softwareTesting =
Double.parseDouble(tfSoftwareTesting.getText());
double operatingSystem =
Double.parseDouble(tfOperatingSystem.getText());
double est = Double.parseDouble(tfEST.getText());
// Calculating total and average
double total = advancedJava + css + softwareTesting + operatingSystem +
est;
double average = total / 5;

// Setting the total and average


values
tfTotal.setText(String.valueOf(total));
tfAverage.setText(String.format("%.2f", average));

// Determining the grade


if (average >= 90) {
tfGrade.setText("A");
} else if (average >= 80)
{ tfGrade.setText("B")
;
} else if (average >= 70)
{ tfGrade.setText("C")
;
} else if (average >= 60)
{ tfGrade.setText("D")
;
} else {
tfGrade.setText("F");
}
} catch (NumberFormatException ex) {
// Showing an error dialog for invalid input
Dialog errorDialog = new Dialog(this, "Input Error", true);
errorDialog.setLayout(new FlowLayout());
errorDialog.add(new Label("Please enter valid numbers"));
errorDialog.setSize(250, 100);
errorDialog.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent we) {
errorDialog.dispose();
}
});
errorDialog.setVisible(true);
}
}

// Method to clear all text


fields private void clearFields() {
tfAdvancedJava.setText("");
tfCSS.setText("");
tfSoftwareTesting.setText("");
tfOperatingSystem.setText("");
tfEST.setText("");
tfTotal.setText("");
tfAverage.setText("");
tfGrade.setText("");
}
// Main method to launch the application
public static void main(String[] args) {
new StudentGradeCalculatorAWT().setVisible(true);
}
}
OUTPUT
CONCLUSION

In conclusion, the Student Grade Calculator developed using Java's AWT


framework effectively demonstrates how to create an intuitive and functional
desktop application for calculating student grades. By allowing users to input
subject marks, the program efficiently computes the total marks, average, and
grade based on predefined criteria. The integration of input validation ensures
that only valid numeric values are processed, preventing potential calculation
errors.

This application highlights essential programming concepts such as event-


driven programming, GUI design, and error handling, making it a practical and
educational tool for students and educators. Its clean interface, real-time
calculation, and ease of use showcase the versatility of Java's AWT library in
creating interactive applications.
REFERENCE

 https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&u
rl=https://codingzap.com/student-grading-system-
java/&ved=2ahUKEwjF1e3ngKaJAxVf1TgGHUIlFVwQFnoECBYQAQ&usg=A
OvVaw1ek5mqk9Sb-VApnX4O5jw8

 https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&u
rl=https://www.tutorialspoint.com/java-program-to-calculate-student-
grades&ved=2ahUKEwjF1e3ngKaJAxVf1TgGHUIlFVwQFnoECBwQAQ&usg
=AOvVaw3uXEWgL_5B2dMXoYy-VcAE

 https://www.google.com/url?sa=t&source=web&rct=j&opi=89978449&u
rl=https://www.geeksforgeeks.org/student-grade-calculator-using-java-
swing/&ved=2ahUKEwjF1e3ngKaJAxVf1TgGHUIlFVwQFnoECDYQAQ&usg
=AOvVaw2SPgoiyymZ2DEHnDSPp_Y_

You might also like