-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStudent.java
64 lines (51 loc) · 1.19 KB
/
Student.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
53
54
55
56
57
58
59
60
61
62
63
64
//==================================
// Foundations of Computer Science
// Student: Prateek Kumar Mondal
// id: a1789674
// Semester: 1
// Year: 1
//===================================
public class Student {
String name;
int physic, chemistry, math;
float average;
public Student(String name, int physic, int chemistry, int math) {
this.name = name;
this.physic = physic;
this.chemistry = chemistry;
this.math = math;
this.average = ((float) (physic + chemistry + math)) / 3;
this.average = Math.round(this.average * 100.0) / 100.0f; // calculating the average marks and rounding till 2
// decimal places
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPhysic() {
return physic;
}
public void setPhysic(int physic) {
this.physic = physic;
}
public int getChemistry() {
return chemistry;
}
public void setChemistry(int chemistry) {
this.chemistry = chemistry;
}
public int getMath() {
return math;
}
public void setMath(int math) {
this.math = math;
}
public float getAverage() {
return average;
}
public void setAverage(float average) {
this.average = average;
}
}