-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGPA.java
More file actions
43 lines (29 loc) · 928 Bytes
/
Copy pathGPA.java
File metadata and controls
43 lines (29 loc) · 928 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package oopproject1;
import javax.swing.JOptionPane;
public class GPA
{
{
String N = JOptionPane.showInputDialog(null,"Total Subjects: ", "CGPA Calculator", JOptionPane.PLAIN_MESSAGE);
int n = Integer.parseInt(N);
double[] marks=new double[n];
System.out.println("Enter marks");
for(int i=0;i<n;i++)
{
String Na = JOptionPane.showInputDialog(null,"Mark : ", "CGPA Calculator", JOptionPane.PLAIN_MESSAGE);
marks[i]=Double.parseDouble(Na);
}
double grade[]=new double[n];
double cgpa,sum=0;
for(int i=0;i<n;i++)
{
grade[i]=(marks[i]/10) ;
}
for(int i=0;i<n;i++)
{
sum+=grade[i];
}
cgpa=sum/n;
JOptionPane.showMessageDialog(null, "Your CGPA :" +cgpa);
JOptionPane.showMessageDialog(null, "Your CGPA :" +cgpa*9.5);
}
}