-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentModule.java
More file actions
57 lines (47 loc) · 1.14 KB
/
Copy pathStudentModule.java
File metadata and controls
57 lines (47 loc) · 1.14 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
package studentArrayList;
import java.util.ArrayList;
import java.util.Scanner;
public class StudentModule
{
private ArrayList<StudentData> alist = new ArrayList<StudentData>();
Scanner sc = new Scanner(System.in);
void studentInformationInput()
{
StudentData sd;
String reply;
do
{
sd = new StudentData();
System.out.println("Enter student name : ");
sd.setStudentName(sc.next());
System.out.println("Enter Math : ");
sd.setMath(sc.nextInt());
System.out.println("Enter Phy : ");
sd.setPhy(sc.nextInt());
System.out.println("Enter Bio : ");
sd.setBio(sc.nextInt());
alist.add(sd);
System.out.println("Do you want to add more? y/n: ");
reply = sc.next();
}
while(reply.equals("y"));
}
void marksCalculation()
{
StudentData sd1;
for(int i=0;i<alist.size();i++)
{
sd1 = alist.get(i);
sd1.setTotal(sd1.getMath()+sd1.getPhy()+sd1.getBio());
alist.set(i, sd1);
}
}
void resultDisplay()
{
for(int i=0;i<alist.size();i++)
{
System.out.println("Student Name is : " + alist.get(i).getStudentName());
System.out.println("Total is : " + alist.get(i).getTotal());
}
}
}