学生管理系统。JAVA

  1 package 作业;
  2 
  3 import java.io.IOException;
  4 import java.util.Scanner;
  5 
  6 public class zuoye {
  7 
  8 public static void main(String[]args) {
  9 Scoreinformation []stu;
 10 stu=new Scoreinformation [5];
 11 
 12 stu[0]=new Scoreinformation(20183578,"郑磊",0,0,0,0,0);
 13 stu[1]=new Scoreinformation(20183571,"路人甲",0,0,0,0,0);
 14 stu[2]=new Scoreinformation(20183572,"路人乙",0,0,0,0,0);
 15 stu[3]=new Scoreinformation(20183573,"路人丙",0,0,0,0,0);
 16 stu[4]=new Scoreinformation(20183574,"路人丁",0,0,0,0,0);
 17 jie();
 18 Scanner in=new Scanner(System.in);
 19 int a=in.nextInt();
 20 int flag=0;
 21 int nm=0;
 22 switch (a) {
 23 case 1: {
 24 
 25 System.out.println("***********************************************************");
 26 System.out.println(" 石家庄铁道大学软件工程系 ");
 27 System.out.println(" 学生学籍管理系统 2019 版 ");
 28 System.out.println("***********************************************************");    
 29 System.out.println(" 请输入学生学号: ");
 30 System.out.println("***********************************************************");
 31 int stud1=in.nextInt();
 32 for(int i=0;i<5;i++)
 33 { if (stud1==stu[i].stunumber)
 34 {flag=1;
 35 nm=i;}
 36 }
 37 if(flag==0)
 38 { System.out.println("学号不存在");
 39 
 40 }
 41 else {
 42 System.out.println("***********************************************************");
 43 System.out.println(" 石家庄铁道大学软件工程系 ");
 44 System.out.println(" 学生学籍管理系统 2019 版 ");
 45 System.out.println("***********************************************************");    
 46 System.out.println(" 学生学号: "+stud1);
 47 System.out.println(" 学生姓名: "+stu[nm].name);
 48 System.out.println(" 请输入高等数学成绩: ");
 49 System.out.println("***********************************************************");
 50 double stud2=in.nextDouble();
 51 stu[nm].mathematicsscore=stud2;
 52 System.out.println("***********************************************************");
 53 System.out.println(" 石家庄铁道大学软件工程系 ");
 54 System.out.println(" 学生学籍管理系统 2019 版 ");
 55 System.out.println("***********************************************************");    
 56 System.out.println(" 学生学号: "+stud1);
 57 System.out.println(" 学生姓名: "+stu[nm].name);
 58 System.out.println(" 高等数学成绩:"+stud2);
 59 System.out.println(" 请输入大学英语成绩: ");
 60 System.out.println("***********************************************************");
 61 double stud3=in.nextDouble();
 62 stu[nm].englishiscore=stud3;
 63 System.out.println("***********************************************************");
 64 System.out.println(" 石家庄铁道大学软件工程系 ");
 65 System.out.println(" 学生学籍管理系统 2019 版 ");
 66 System.out.println("***********************************************************");    
 67 System.out.println(" 学生学号: "+stud1);
 68 System.out.println(" 学生姓名: "+stu[nm].name);
 69 System.out.println(" 高等数学成绩:"+stud2);
 70 System.out.println(" 大学英语成绩:"+stud3);
 71 System.out.println(" 请输入计算机网络成绩: ");
 72 System.out.println("***********************************************************");
 73 double stud4=in.nextDouble();
 74 stu[nm].networkscore=stud4; 
 75 System.out.println("***********************************************************");
 76 System.out.println(" 石家庄铁道大学软件工程系 ");
 77 System.out.println(" 学生学籍管理系统 2019 版 ");
 78 System.out.println("***********************************************************");    
 79 System.out.println(" 学生学号: "+stud1);
 80 System.out.println(" 学生姓名: "+stu[nm].name);
 81 System.out.println(" 高等数学成绩:"+stud2);
 82 System.out.println(" 大学英语成绩:"+stud3);
 83 System.out.println(" 计算机网络成绩:"+stud4);
 84 System.out.println(" 请输入数据库成绩: ");
 85 System.out.println("***********************************************************");
 86 double stud5=in.nextDouble();
 87 stu[nm].databasescore=stud5; 
 88 System.out.println("***********************************************************");
 89 System.out.println(" 石家庄铁道大学软件工程系 ");
 90 System.out.println(" 学生学籍管理系统 2019 版 ");
 91 System.out.println("***********************************************************");    
 92 System.out.println(" 学生学号: "+stud1);
 93 System.out.println(" 学生姓名: "+stu[nm].name);
 94 System.out.println(" 高等数学成绩:"+stud2);
 95 System.out.println(" 大学英语成绩:"+stud3);
 96 System.out.println(" 计算机网络成绩:"+stud4);
 97 System.out.println(" 数据库成绩: "+stud5);
 98 System.out.println(" 请输入软件工程成绩: ");
 99 System.out.println("***********************************************************");
100 double stud6=in.nextDouble();
101 stu[nm].softwarescore=stud6; 
102 System.out.println("***********************************************************");
103 System.out.println(" 石家庄铁道大学软件工程系 ");
104 System.out.println(" 学生学籍管理系统 2019 版 ");
105 System.out.println("***********************************************************");    
106 System.out.println(" 学生学号: "+stud1);
107 System.out.println(" 学生姓名: "+stu[nm].name);
108 System.out.println(" 高等数学成绩:"+stud2);
109 System.out.println(" 大学英语成绩:"+stud3);
110 System.out.println(" 计算机网络成绩:"+stud4);
111 System.out.println(" 数据库成绩: "+stud5);
112 System.out.println(" 软件工程成绩:"+stud6);
113 System.out.println(" 该学生成绩已录入完毕,是否提交(Y/N) ");
114 System.out.println("***********************************************************");
115  
116 
117 } 
118 
119 }
120 case 2: { 
121 System.out.println("***********************************************************");
122 System.out.println(" 石家庄铁道大学软件工程系 ");
123 System.out.println(" 学生学籍管理系统 2019 版 ");
124 System.out.println("***********************************************************");    
125 System.out.println(" 请输入学生学号: ");
126 System.out.println("***********************************************************");
127 int q1=in.nextInt();
128 for(int i=0;i<5;i++)
129 {if (q1==stu[i].stunumber)
130 {flag=1;
131 nm=i;}
132 }
133 if(flag==0)
134 { System.out.println("学号不存在");
135 
136 }
137 System.out.println("***********************************************************");
138 System.out.println(" 石家庄铁道大学软件工程系 ");
139 System.out.println(" 学生学籍管理系统 2019 版 ");
140 System.out.println("***********************************************************");    
141 System.out.println(" 学生学号: "+q1);
142 System.out.println(" 学生姓名: "+stu[nm].name);
143 System.out.println(" 1高等数学成绩:"+stu[nm].mathematicsscore);
144 System.out.println(" 2大学英语成绩:"+stu[nm].englishiscore);
145 System.out.println(" 3计算机网络成绩:"+stu[nm].networkscore);
146 System.out.println(" 4数据库成绩: "+stu[nm]. databasescore );
147 System.out.println(" 5软件工程成绩:"+stu[nm].softwarescore);
148 System.out.println("***********************************************************");
149 int p1=in.nextInt();
150 switch (p1) 
151 {case 1:{double mn=in.nextDouble();
152 stu[nm].mathematicsscore=mn;break;}
153 case 2:{double mn=in.nextDouble();
154 stu[nm].englishiscore=mn;break;}
155 case 3:{double mn=in.nextDouble();
156 stu[nm].networkscore=mn;break;}
157 case 4:{double mn=in.nextDouble();
158 stu[nm].databasescore=mn;break;}
159 case 5:{double mn=in.nextDouble();
160 stu[nm].softwarescore=mn;break;}
161 }
162 System.out.println("***********************************************************");
163 System.out.println(" 石家庄铁道大学软件工程系 ");
164 System.out.println(" 学生学籍管理系统 2019 版 ");
165 System.out.println("***********************************************************");    
166 System.out.println(" 学生学号: "+q1);
167 System.out.println(" 学生姓名: "+stu[nm].name);
168 System.out.println(" 1高等数学成绩:"+stu[nm].mathematicsscore);
169 System.out.println(" 2大学英语成绩:"+stu[nm].englishiscore);
170 System.out.println(" 3计算机网络成绩:"+stu[nm].networkscore);
171 System.out.println(" 4数据库成绩: "+stu[nm]. databasescore );
172 System.out.println(" 5软件工程成绩:"+stu[nm].softwarescore);
173 System.out.println(" 该学生成绩已修改完毕,是否提交(Y/N) ");
174 System.out.println("***********************************************************");
175 String stud7=in.next();
176 if(stud7=="Y")
177 {
178 
179 }
180 }
181 
182 case 3:{
183 int q1=in.nextInt();
184 System.out.println("***********************************************************");
185 System.out.println(" 石家庄铁道大学软件工程系 ");
186 System.out.println(" 学生学籍管理系统 2019 版 ");
187 System.out.println("***********************************************************");    
188 System.out.println(" 请输入学生学号: ");
189 System.out.println("***********************************************************");
190 for(int i=0;i<5;i++)
191 {if (q1==stu[i].stunumber)
192 {flag=1;
193 nm=i;}
194 }
195 if(flag==0)
196 { System.out.println("学号不存在");
197 
198 } 
199 double a1,a2,a3,a4,a5,a6;
200 if(stu[nm].mathematicsscore>=90)
201 a1=4;
202 else if(stu[nm].mathematicsscore>=85&&stu[nm].mathematicsscore<90)
203 a1=3.7;
204 else if(stu[nm].mathematicsscore>=82&&stu[nm].mathematicsscore<85)
205 a1=3.3;
206 else if(stu[nm].mathematicsscore>=78&&stu[nm].mathematicsscore<82)
207 a1=3.0;
208 else if(stu[nm].mathematicsscore>=75&&stu[nm].mathematicsscore<78)
209 a1=2.7;
210 else if(stu[nm].mathematicsscore>=72&&stu[nm].mathematicsscore<75)
211 a1=2.3;
212 else if(stu[nm].mathematicsscore>=68&&stu[nm].mathematicsscore<72)
213 a1=2.0;
214 else if(stu[nm].mathematicsscore>=66&&stu[nm].mathematicsscore<68)
215 a1=1.7;
216 else if(stu[nm].mathematicsscore>=64&&stu[nm].mathematicsscore<66)
217 a1=1.5;
218 else if(stu[nm].mathematicsscore>=60&&stu[nm].mathematicsscore<64)
219 a1=1.0;
220 else 
221 a1=0;
222 if(stu[nm].englishiscore>=90)
223 a2=4;
224 else if(stu[nm].englishiscore>=85&&stu[nm].englishiscore<90)
225 a2=3.7;
226 else if(stu[nm].englishiscore>=82&&stu[nm].englishiscore<85)
227 a2=3.3;
228 else if(stu[nm].englishiscore>=78&&stu[nm].englishiscore<82)
229 a2=3.0;
230 else if(stu[nm].englishiscore>=75&&stu[nm].englishiscore<78)
231 a2=2.7;
232 else if(stu[nm].englishiscore>=72&&stu[nm].englishiscore<75)
233 a2=2.3;
234 else if(stu[nm].englishiscore>=68&&stu[nm].englishiscore<72)
235 a2=2.0;
236 else if(stu[nm].englishiscore>=66&&stu[nm].englishiscore<68)
237 a2=1.7;
238 else if(stu[nm].englishiscore>=64&&stu[nm].englishiscore<66)
239 a2=1.5;
240 else if(stu[nm].englishiscore>=60&&stu[nm].englishiscore<64)
241 a2=1.0;
242 else 
243 a2=0;
244 
245 if(stu[nm].databasescore>=90)
246 a4=4;
247 else if(stu[nm].databasescore>=85&&stu[nm].databasescore<90)
248 a4=3.7;
249 else if(stu[nm].databasescore>=82&&stu[nm].databasescore<85)
250 a4=3.3;
251 else if(stu[nm].databasescore>=78&&stu[nm].databasescore<82)
252 a4=3.0;
253 else if(stu[nm].databasescore>=75&&stu[nm].databasescore<78)
254 a4=2.7;
255 else if(stu[nm].databasescore>=72&&stu[nm].databasescore<75)
256 a4=2.3;
257 else if(stu[nm].databasescore>=68&&stu[nm].databasescore<72)
258 a4=2.0;
259 else if(stu[nm].databasescore>=66&&stu[nm].databasescore<68)
260 a4=1.7;
261 else if(stu[nm].databasescore>=64&&stu[nm].databasescore<66)
262 a4=1.5;
263 else if(stu[nm].databasescore>=60&&stu[nm].databasescore<64)
264 a4=1.0;
265 else 
266 a4=0;
267 
268 if(stu[nm].softwarescore>=90)
269 a5=4;
270 else if(stu[nm].softwarescore>=85&&stu[nm].softwarescore<90)
271 a5=3.7;
272 else if(stu[nm].softwarescore>=82&&stu[nm].softwarescore<85)
273 a5=3.3;
274 else if(stu[nm].softwarescore>=78&&stu[nm].softwarescore<82)
275 a5=3.0;
276 else if(stu[nm].softwarescore>=75&&stu[nm].softwarescore<78)
277 a5=2.7;
278 else if(stu[nm].softwarescore>=72&&stu[nm].softwarescore<75)
279 a5=2.3;
280 else if(stu[nm].softwarescore>=68&&stu[nm].softwarescore<72)
281 a5=2.0;
282 else if(stu[nm].softwarescore>=66&&stu[nm].softwarescore<68)
283 a5=1.7;
284 else if(stu[nm].softwarescore>=64&&stu[nm].softwarescore<66)
285 a5=1.5;
286 else if(stu[nm].softwarescore>=60&&stu[nm].softwarescore<64)
287 a5=1.0;
288 else 
289 a5=0;
290 if(stu[nm].networkscore>=90)
291 a3=4;
292 else if(stu[nm].networkscore>=85&&stu[nm].networkscore<90)
293 a3=3.7;
294 else if(stu[nm].networkscore>=82&&stu[nm].networkscore<85)
295 a3=3.3;
296 else if(stu[nm].networkscore>=78&&stu[nm].networkscore<82)
297 a3=3.0;
298 else if(stu[nm].networkscore>=75&&stu[nm].networkscore<78)
299 a3=2.7;
300 else if(stu[nm].networkscore>=72&&stu[nm].networkscore<75)
301 a3=2.3;
302 else if(stu[nm].networkscore>=68&&stu[nm].networkscore<72)
303 a3=2.0;
304 else if(stu[nm].networkscore>=66&&stu[nm].networkscore<68)
305 a3=1.7;
306 else if(stu[nm].networkscore>=64&&stu[nm].networkscore<66)
307 a3=1.5;
308 else if(stu[nm].networkscore>=60&&stu[nm].networkscore<64)
309 a3=1.0;
310 else 
311 a3=0;
312 Double b=(a1*4+a2*3+a3*4+a4*3+a5*2)/16;
313 if(b>=2) {
314 
315 System.out.println("***********************************************************");
316 System.out.println(" 石家庄铁道大学软件工程系 ");
317 System.out.println(" 学生学籍管理系统 2019 版 ");
318 System.out.println("***********************************************************");    
319 System.out.println(" 学生学号: "+q1);
320 System.out.println(" 学生姓名: "+stu[nm].name);
321 System.out.println(" 1、高等数学成绩绩点:"+a1);
322 System.out.println(" 2、大学英语成绩绩点:"+a2);
323 System.out.println(" 3、计算机网络成绩绩点: "+a3 );
324 System.out.println(" 4、数据库成绩绩点: "+a4 );
325 System.out.println(" 5、软件工程成绩绩点:"+a5);
326 System.out.println(" 你的学分绩点已达到毕业要求 ");
327 System.out.println("***********************************************************");
328 }
329 else 
330 {
331 
332 System.out.println("***********************************************************");
333 System.out.println(" 石家庄铁道大学软件工程系 ");
334 System.out.println(" 学生学籍管理系统 2019 版 ");
335 System.out.println("***********************************************************");    
336 System.out.println(" 学生学号: "+q1);
337 System.out.println(" 学生姓名: "+stu[nm].name);
338 System.out.println(" 1、高等数学成绩绩点:"+a1);
339 System.out.println(" 2、大学英语成绩绩点:"+a2);
340 System.out.println(" 3、计算机网络成绩绩点: "+a3 );
341 System.out.println(" 4、数据库成绩绩点: "+a4 );
342 System.out.println(" 5、软件工程成绩绩点:"+a5);
343 System.out.println(" 你的学分绩点不满足毕业要求 ");
344 System.out.println("***********************************************************");
345 }break;
346 }
347 case 4:System.out.println("***********************************************************");
348 System.out.println(" 谢谢使用石家庄铁道大学软件工程系学生学籍管理系统 2019 版 "); 
349 System.out.println(" 制作人:郑磊 ");
350 System.out.println("***********************************************************");    
351 default : System.out.println("输入错误 ");
352 }
353 // TODO 自动生成的方法存根
354 
355 }
356 static void jie() {
357 
358 
359 System.out.println("***********************************************************");
360 System.out.println(" 石家庄铁道大学软件工程系 ");
361 System.out.println(" 学生学籍管理系统 2019 版 ");
362 System.out.println("***********************************************************");    
363 System.out.println(" 1、 学生考试成绩录入 ");
364 System.out.println(" 2、 学生考试成绩修改 ");
365 System.out.println(" 3、 计算学生成绩绩点 ");
366 System.out.println(" 4、退出学籍管理系统 ");    
367 System.out.println("***********************************************************");
368 
369 // TODO 自动生成的方法存根
370 
371 }
372 
373 }
374 
375 
376 
377 以上为主函数,下面是定义的类
378 
379 package 作业;
380 
381 public class Scoreinformation{
382 public int stunumber;
383 public String name;
384 public double mathematicsscore;
385 public double networkscore;
386 public double databasescore;
387 public double softwarescore;
388 public double englishiscore;
389 void setmathematicsscore() {mathematicsscore=100;
390 } void setnetworkscore() {networkscore=100;
391 } void setdatabasescore() { databasescore=100;
392 } void setsoftwarescore() {softwarescore=100;
393 }
394 void setenglishiscore() {englishiscore=100;
395 }
396 void getstunumber(int a) {
397 stunumber=a;
398 
399 }
400 void getname(String b) {
401 name=b;
402 
403 }
404 void getmathematicsscore(double c) {
405 mathematicsscore=c;
406 }
407 void getnetworkscore(double d) {
408 networkscore=d;
409 }
410 void getdatabasescore(double e) { 
411 databasescore=e;
412 }
413 void getsoftwarescore(double f) {
414 softwarescore=f;
415 }
416 void getenglishiscore(double g) {
417 softwarescore=g;
418 }
419 public 
420 Scoreinformation(int stunumber,String name,double mathematicsscore,double englishiscore,double networkscore,double databasescore,double softwarescore)
421 {
422 this.stunumber=stunumber;
423 this.name=name;
424 this.mathematicsscore=mathematicsscore;
425 this.englishiscore=englishiscore;
426 this.networkscore=networkscore;
427 this.databasescore=databasescore;
428 this.softwarescore=softwarescore;
429 }
430 }

 第一个功能是输入学号进行搜索学生项目,并对其进行成绩修改

提示用户输入高等数学成绩,用户输入正确的数字;则提示用户输入大学
英语成绩,依次类推,提示用户录入计算机网络、数据库、软件工程成绩

,然后会提示,是否保存

如果输入错误的数字,则会提示,数字错误

输入完成后,就会显示所有的成绩

 

第二个功能是对成绩进行修改

如上图即可得。

最后就是计算学分绩点的功能

 根据输入的成绩自动计算是否能够毕业。

再最后就是可以按4,退出系统。

心得:作为本学期,第一个自己开发的小程序,还是很开心的,何况还是一个新接触到的语言。在这次编程过程中,我逐渐了解到了JAVA的一些需要了解到的事情。一些基本的语言技巧等等。这些给我带来了很多成就感,离开老师,我们也可以自学到编程语言,虽然,这次开发的并不算什么特别难的程序,但开学,自学到这种程度,我觉得还是挺满意的。

猜你喜欢

转载自www.cnblogs.com/520520520zl/p/11514761.html