-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGradeCalculator.java
More file actions
25 lines (17 loc) · 1.22 KB
/
Copy pathGradeCalculator.java
File metadata and controls
25 lines (17 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import javax.swing.JOptionPane;
public class GradeCalculator {
public static void main(String[] args) {
double attendanceScore = Double.parseDouble(JOptionPane.showInputDialog("Enter Attendance Score:"));
double assignmentScore = Double.parseDouble(JOptionPane.showInputDialog("Enter Assignment Score:"));
double quizScore = Double.parseDouble(JOptionPane.showInputDialog("Enter Quiz Score:"));
double labActivityScore = Double.parseDouble(JOptionPane.showInputDialog("Enter Laboratory Activity Score:"));
double examScore = Double.parseDouble(JOptionPane.showInputDialog("Enter Exam Score:"));
double attendanceWeighted = (((attendanceScore / 15) * 60) + 40) * 0.10;
double assignmentWeighted = (((assignmentScore / 50) * 60) + 40) * 0.15;
double quizWeighted = (((quizScore / 80) * 60) + 40) * 0.20;
double labActivityWeighted = (((labActivityScore / 100) * 60) + 40) * 0.25;
double examWeighted = (((examScore / 100) * 60) + 40) * 0.30;
double totalGrade = attendanceWeighted + assignmentWeighted + quizWeighted + labActivityWeighted + examWeighted;
JOptionPane.showMessageDialog(null, String.format("Total Grade: %.2f", totalGrade));
}
}