-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.java
More file actions
42 lines (41 loc) · 847 Bytes
/
Copy pathStudent.java
File metadata and controls
42 lines (41 loc) · 847 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
import java.util.*;
class student
{
int rno,m1,m2,m3,m4,m5,m6,t;
String name;
float p;
void accept()
{
Scanner sc=new Scanner(System.in);
System.out.print("Enter Roll Number = ");
rno=sc.nextInt();
System.out.print("Enter Name = ");
name=sc.next();
System.out.print("Enter any subject mark = ");
m1=sc.nextInt();
m2=sc.nextInt();
m3=sc.nextInt();
m4=sc.nextInt();
m5=sc.nextInt();
m6=sc.nextInt();
}
void calculate()
{
t=m1+m2+m3+m4+m5+m6;
p=(float) t/6;
}
void disp()
{
System.out.println("Roll Num = "+rno);
System.out.println("Name = "+name);
System.out.println("Total Marks = "+t);
System.out.println("Percentage = "+p);
}
public static void main(String arg[])
{
student ob=new student();
ob.accept();
ob.calculate();
ob.disp();
}
}