forked from Kartikey0205/Colege-JavaLab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathp022studentNumber.java
More file actions
87 lines (44 loc) · 1.26 KB
/
p022studentNumber.java
File metadata and controls
87 lines (44 loc) · 1.26 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
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import java.util.*;
class student {
int Registration;
String name;
int total = 0;
int a[] = new int[5];
Scanner sc = new Scanner(System.in);
student() {
System.out.print("Registration: ");
Registration = sc.nextInt();
System.out.print("Name ");
name = sc.next();
for (int k = 0; k < 4; k++) {
System.out.println("Enter marks of " + k + " th subject");
a[k] = sc.nextInt();
}
}
void print() {
System.out.println("Name of student is " + name);
System.out.println("Registration number is " + Registration);
for (int k = 0; k < 5; k++) {
total = total + a[k];
}
System.out.println("total= " + total);
int lol = total / 5;
System.out.println("average=" + lol);
System.out.println();
}
}
public class p022studentNumber
{
public static void main(String[] args) {
student stu1 = new student();
stu1.print();
student stu2 = new student();
stu2.print();
student stu3 = new student();
stu3.print();
student stu4 = new student();
stu4.print();
student stu5 = new student();
stu5.print();
}
}