Java PBL Project
Java PBL Project
PROJECT
ON
CGPA CALCULATOR
BACHELOR OF TECHNOLOGY
IN
INFORMATION TECHNOLOGY
Submitted By
I.Harshenniee 238R1A12F4
G.SAI TEJA REDDY 238R1A12F3
J. BHARATH REDDY 238R1A12F5
J.SUNNY REDDY 238R1A12F6
Mrs.G.SWETHA
Assistant Professor
1
IT DEPT CMREC
CERTIFICATE
I.Harshenniee 238R1A12F4
G.SAI TEJA REDDY 238R1A12F3
J. BHARATH REDDY 238R1A12F5
J.SUNNY REDDY 238R1A12F6
Mrs.G.SWETHA
2
IT DEPT CMREC
TABLE OF CONTENTS:
1) ABSTRACT 4
2) INTRODUCTION 5
3) CODE 6 - 11
4) IMPLEMENTATION 12
5) CONCLUSION 13
3
JAVA LAB PROJECT
ABSTRACT
The Cumulative Grade Point Average (CGPA) serves as a standardized metric for
evaluating a student's overall academic performance. This abstract provides an
insight into the methodology of CGPA calculation, which involves assigning grade
points to individual course grades, considering credit hours, and deriving a
cumulative measure. The significance of CGPA extends beyond a mere numerical
representation, as it enables easy comparisons between students, departments, and
institutions, serves as a criterion for eligibility in academic and professional
opportunities, and fosters a culture of continuous improvement among students. In
conclusion, CGPA is a pivotal tool in educational assessment, offering a holistic view
of a student's scholastic achievements. Its widespread use underscores its importance
in academic and professional spheres, contributing to transparency, fairness, and the
encouragement of academic excellence.
4
IT DEPT CMREC
INTRODUCTION
The process of Calculating Cumulative Grade Point Average (CGPA) is a
fundamental aspect of academic assessment that provides a comprehensive
representation of a student's overall performance throughout their academic journey.
CGPA serves as a standardized measure, condensing the diverse range of individual
course grades into a single numerical value. This method of evaluation involves the
conversion of letter grades into corresponding grade points, considering credit hours,
and ultimately deriving an average that encapsulates a student's academic
achievements across various subjects. As a widely adopted metric in educational
institutions globally, CGPA not only simplifies the evaluation process but also plays
a crucial role in facilitating comparisons, determining eligibility for academic and
professional opportunities, and fostering a culture of continuous improvement among
students. Understanding the intricacies of CGPA calculation is essential for both
students and educators, as it forms the basis for academic recognition and provides
valuable insights into a student's scholastic capabilities.The next step in the CGPA
calculation considers the credit hours associated with each course. Credit hours
reflect the academic workload and the time commitment required for a particular
course. Multiplying the grade points assigned to each course by the respective credit
hours yields the grade points earned for that course. The cumulative grade points are
then obtained by summing up the grade points earned across all courses.
5
IT DEPT CMREC
CODE:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public StudentCGPACalculator() {
subjects = new ArrayList<>();
// Input Panel
JPanel inputPanel = new JPanel(new GridLayout(4, 2, 5, 5));
inputPanel.setBorder(BorderFactory.createTitledBorder("Add Subject"));
inputPanel.add(new JLabel("Marks:"));
marksField = new JTextField();
inputPanel.add(marksField);
inputPanel.add(new JLabel("Credits:"));
creditsField = new JTextField();
6
IT DEPT CMREC
inputPanel.add(creditsField);
// Subjects Area
subjectsArea = new JTextArea(10, 40);
subjectsArea.setEditable(false);
JScrollPane subjectsScrollPane = new JScrollPane(subjectsArea);
subjectsScrollPane.setBorder(BorderFactory.createTitledBorder("Added
Subjects"));
// Result Area
resultArea = new JTextArea(5, 40);
resultArea.setEditable(false);
JScrollPane resultScrollPane = new JScrollPane(resultArea);
resultScrollPane.setBorder(BorderFactory.createTitledBorder("Results"));
// Calculate Button
JButton calculateButton = new JButton("Calculate Results");
calculateButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
calculateResults();
}
});
// Main Panel
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
7
IT DEPT CMREC
mainPanel.add(inputPanel);
mainPanel.add(Box.createRigidArea(new Dimension(0, 10)));
mainPanel.add(subjectsScrollPane);
mainPanel.add(Box.createRigidArea(new Dimension(0, 10)));
mainPanel.add(calculateButton);
mainPanel.add(Box.createRigidArea(new Dimension(0, 10)));
mainPanel.add(resultScrollPane);
add(mainPanel, BorderLayout.CENTER);
}
8
IT DEPT CMREC
updateSubjectsArea();
clearInputFields();
} catch (NumberFormatException ex) {
JOptionPane.showMessageDialog(this, "Please enter valid numbers for marks
and credits.", "Input Error", JOptionPane.ERROR_MESSAGE);
}
}
double weightedMarksSum = 0;
int totalCredits = 0;
// Calculate the percentage and CGPA based on total weighted marks and total
credits
double percentage = weightedMarksSum / totalCredits;
double cgpa = percentage / 9.5; // Assuming CGPA is calculated by dividing the
percentage by 9.5
resultArea.setText(result);
}
10
IT DEPT CMREC
@Override
public String toString() {
return String.format("%s - Marks: %.2f, Credits: %d", name, marks, credits);
}
}
11
IT DEPT CMREC
IMPLEMENTATION
12
IT DEPT CMREC
CONCLUSION
13