-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstudentInformation.java
More file actions
170 lines (153 loc) · 3.62 KB
/
studentInformation.java
File metadata and controls
170 lines (153 loc) · 3.62 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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
import java.util.*;
class StudentInformation
{
String name;
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return this.name;
}
String fatherName;
public void setFatherName(String fatherName)
{
this.fatherName=fatherName;
}
public String getFatherName()
{
return this.fatherName;
}
String rollNumber;
public void setRollNo(String rollNo)
{
this.rollNumber=rollNo;
}
public String getRollNo()
{
return this.rollNumber;
}
String mobileNumber;
public void setMobileNumber(String mobileNumber)
{
this.mobileNumber=mobileNumber;
}
public String getMobileNumber()
{
return this.mobileNumber;
}
}
class StudentResult extends StudentInformation
{
int physics;
public void setPhysicsMarks(int physics)
{
if(physics>=0 && physics<=100){
this.physics=physics;
}
else
{
System.out.println("Wrong Input");
}
}
public int getPhysicsMarks()
{
return this.physics;
}
int mathematics;
public void setMathematicsMarks(int mathematics)
{
if(mathematics >=0 && mathematics <= 100)
this.mathematics=mathematics;
else System.out.println("Wrong Input");
}
public int getMathematicsMarks()
{
return this.mathematics;
}
int chemistry;
public void setChemistryMarks(int chemistry)
{
if(chemistry>=0&&chemistry<=100)
this.chemistry=chemistry;
else System.out.println("Wrong Input");
}
public int getChemistryMarks()
{
return this.chemistry;
}
int hindi;
public void setHindiMarks(int hindi)
{
if(hindi>=0&&hindi<=100)
this.hindi=hindi;
else System.out.println("Wrong Input");
}
public int getHindiMarks()
{
return this.hindi;
}
int english;
public void setEnglishMarks(int english)
{
if(english>=0 && english<=100)
this.english=english;
else System.out.println("Wrong Input");
}
public int getEnglishMarks()
{
return this.english;
}
public int total(int mathematics,int physics,int chemistry,int hindi,int english)
{
int total = mathematics+physics+chemistry+hindi+english;
return total;
}
}
class student
{
public static void main(String gg[])
{
StudentResult si = new StudentResult();
Scanner sc=new Scanner(System.in);
System.out.print("Enter Student Name : ");
String str1=sc.next();
si.setName(str1);
System.out.print("Enter Student Father Name : ");
String str2=sc.next();
si.setFatherName(str2);
System.out.println("..................Choose the Menu.................. ");
System.out.println("Press 1 for Result- ");
System.out.println("Press 2 for Edit ");
System.out.println("Press 3 for Delete ");
System.out.println("press 4 for Update ");
System.out.println("Press 5 for Show Result");
int pera=sc.nextInt();
if(pera==1)
{
System.out.print("Enter Physics Marks- ");
int p=sc.nextInt();
si.setPhysicsMarks(p);
System.out.print("Enter Chemistry Marks- ");
int c=sc.nextInt();
si.setChemistryMarks(c);
System.out.print("Enter Mathematics Marks- ");
int m=sc.nextInt();
si.setMathematicsMarks(m);
System.out.print("Enter Hindi Marks- ");
int h=sc.nextInt();
si.setHindiMarks(h);
System.out.print("Enter English Marks- ");
int e=sc.nextInt();
si.setEnglishMarks(e);
int total=si.total(p,c,m,h,e);
int per=total/5;
System.out.println("Total is : " + total + " Percentage is : "+per);
} //System.in is a standard input stream
else
{
System.out.println("Wrong OutPut");
}
}
}