-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path66_StudentRecord.java
More file actions
59 lines (47 loc) · 1.15 KB
/
66_StudentRecord.java
File metadata and controls
59 lines (47 loc) · 1.15 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
/*
Comlete Student report Card
*/
package javaprograms;
/**
*
* @author Geeky Keshav
*/
public class StudentRecord
{
int rollno;
String name;
int s1,s2,s3,s4,s5;
int total;
float avg;
int insert(int r, String n, int sb1, int sb2, int sb3, int sb4, int sb5)
{
rollno=r;
name=n;
s1=sb1;
s2=sb2;
s3=sb3;
s4=sb4;
s5=sb5;
return total=s1+s2+s3+s4+s5;
}
public void disp()
{
System.out.println("Roll no.: "+rollno+","+"Name: "+name +","+"Total: "+total+","+ "Average: "+(avg=(total/5)));
}
}
class studrec
{
public static void main(String args[])
{
StudentRecord obj1=new StudentRecord();
StudentRecord obj2=new StudentRecord();
obj1.insert(100, "Geeky", 90, 80, 70, 80, 60);
obj2.insert(101,"Keshav",98,95,85,88,89);
obj1.disp();
obj2.disp();
}
}
/****OUTPUT****
Roll no.: 100,Name: Geeky,Total: 380,Average: 76.0
Roll no.: 101,Name: Keshav,Total: 455,Average: 91.0
*/