-
Notifications
You must be signed in to change notification settings - Fork 0
/
StudentDemo.java
52 lines (47 loc) · 1.25 KB
/
StudentDemo.java
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
44
45
46
47
48
49
50
51
52
import java.io.*;
import java.util.*;
class Student
{
Scanner sc=new Scanner(System.in);
int RegNo,Total=0,subjects,percent;
String name;
int marks[];
Student()
{
System.out.print("Enter Registration No.: ");
RegNo=sc.nextInt();
System.out.print("Enter Student Name: ");
name=sc.next();;
getDisMarks();
}
public void getDisMarks()
{
marks=new int[5];
System.out.print("Enter marks of Physics: ");
marks[0]=sc.nextInt();
System.out.print("Enter marks of Chemistry: ");
marks[1]=sc.nextInt();
System.out.print("Enter marks of Maths: ");
marks[2]=sc.nextInt();
System.out.print("Enter marks of SS: ");
marks[3]=sc.nextInt();
System.out.print("Enter marks of Hindi: ");
marks[4]=sc.nextInt();
for(int i=0;i<5;i++)
{
Total+=marks[i];
}
percent=(Total*100)/500;
System.out.println("Total Marks of student "+name+": " +Total);
System.out.println("Percentage of student "+name+": " +percent+"%");
}
}
class StudentDemo
{
public static void main(String args[])
{
Student s[]=new Student[5];
for(int i=0;i<5;i++)
s[i]=new Student();
}
}