This is a Java program that calculates your Semester Grade Point Average (SGPA) based on the grades and credits of the subjects you have taken in a semester.Additionally, it provides a feature to save the calculated SGPA and inputted marks to a file.
- Open the terminal or command prompt.
- Navigate to the directory where the program is saved.
- Compile the program using the command
javac SGPA.java
. - Run the program using the command
java SGPA
. - Enter the number of subjects you have taken in the semester.
- Enter the grade and credits of each subject when prompted.
- The program will display your SGPA.
- The program will also save the entered data and SGPA to a file named
[Name]_sgpa_data.txt
(e.g.,John_Doe_sgpa_data.txt
).
This program uses the following grade point scale:
Grade | Grade Point |
---|---|
A+ | 10.0 |
A | 9.0 |
B+ | 8.0 |
B | 7.0 |
C+ | 6.0 |
C | 5.0 |
D | 4.0 |
F | 0.0 |
If your university uses a different grade point scale, you can modify the getGradePoint()
method in the program to match your university's scale.
Enter your name: John Doe
Enter your ID: 12345
Enter the number of subjects: 4
Subject 1:
Enter the subject credits: 3
Enter the subject grade: A
Subject 2:
Enter the subject credits: 4
Enter the subject grade: B+
Subject 3:
Enter the subject credits: 3
Enter the subject grade: C
Subject 4:
Enter the subject credits: 2
Enter the subject grade: B
Your SGPA (Semester Grade Point Average) is: 7.33
Data saved to file: John_Doe_sgpa_data.txt
The file "John_Doe_sgpa_data.txt" will contain the following information:
Name: John Doe
ID: 12345
Subject 1: Credits: 3.0, Grade: A
Subject 2: Credits: 4.0, Grade: B+
Subject 3: Credits: 3.0, Grade: C
Subject 4: Credits: 2.0, Grade: B
SGPA: 7.33
This program assumes that all subjects have equal credit weightage. If the credit weightage of the subjects in your previous semester was different, you will need to modify the program accordingly.
If you find any issues with the program, feel free to raise an issue or submit a pull request. Contributions are always welcome!