激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|VB|R語(yǔ)言|JavaScript|易語(yǔ)言|vb.net|

服務(wù)器之家 - 編程語(yǔ)言 - Java教程 - java學(xué)生信息管理系統(tǒng)源代碼

java學(xué)生信息管理系統(tǒng)源代碼

2021-03-23 14:05liuyakui Java教程

這篇文章主要為大家詳細(xì)介紹了java學(xué)生信息管理系統(tǒng)源代碼,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了java學(xué)生信息管理系統(tǒng)的具體代碼,實(shí)現(xiàn)學(xué)生信息: 增加 int[] a=new int[9] 、刪除 、查找、更改,供大家參考,具體內(nèi)容如下

?
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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
/*學(xué)生信息管理系統(tǒng),實(shí)現(xiàn)學(xué)生信息:
 *增加 int[] a=new int[9]
 *刪除
 *查找
 *更改
 */
import java.util.Scanner;//導(dǎo)入java輸入流
import java.lang.*;
import java.io.*;
class Student
{
 private static Student[] s=new Student[2];
 int n=0;
 private String name;
 private int num;
 private String classAge;
 
 public void judge()throws IOException
 {
 int i;
 char ch;
 String str;
 Scanner In=new Scanner(System.in);
 if(n==0)
 {
  System.out.print("你還沒(méi)有錄入任何學(xué)生,是否錄入(Y/N):");
  str=In.next();
  ch=str.charAt(0);
  while(ch!='Y'&&ch!='y'&&ch!='N'&&ch!='n')
  {
  System.out.print("輸入有誤,請(qǐng)重新輸入:");
  str=In.next();
  ch=str.charAt(0);
  }
  if(ch=='Y'||ch=='y')
  {
  this.add();
  }
  if(ch=='N'||ch=='n')
  {
  this.menu();
  }
 }
 }
 
 public void menu()throws IOException//定義菜單函數(shù)
 {
 int a;//定義switch語(yǔ)句變量
 Scanner in=new Scanner(System.in);//實(shí)例化輸入流對(duì)象
 System.out.println("*********學(xué)生信息管理系統(tǒng)功能表*********");
 System.out.println("*****  1.增加  *****");
 System.out.println("*****  2.顯示  *****");
 System.out.println("*****  3.修改  *****");
 System.out.println("*****  4.刪除  *****");
 System.out.println("*****  5.查看  *****");
 System.out.println("*****  0.退出  *****");
 System.out.println("****************************************");
 System.out.print("請(qǐng)選擇(0~5):");
 a=in.nextInt();
 while(a<0||a>5)
 {
  System.out.print("輸入超出范圍,請(qǐng)重新輸入:");
  a=in.nextInt();
 }
 switch(a)
 {
  case 1:this.add();break;
  case 2:this.show();break;
  case 3:this.modif();break;
  case 4:this.delete();break;
  case 5:this.look();break;
  case 0:System.exit(0);break;
 
 }
 
 public void add()throws IOException//定義增加函數(shù)
 {
 String str,str1,str2;
 int i,num1,t=1;
 char ch,ch1;
 FileWriter fw=new FileWriter("F://javaFile//student.txt",true);
 fw.write("  錄入的學(xué)生信息列表\r\n\r\n學(xué)號(hào) 姓名 班級(jí)\r\n");
 Scanner In=new Scanner(System.in);
 while(t==1)
 {
  System.out.print("請(qǐng)輸入學(xué)生學(xué)號(hào):");
  num1=In.nextInt();
  for(i=0;i<n;i++)
  {
  while(s[i].num==num1)
  {
   System.out.println("已存在此學(xué)號(hào),請(qǐng)重新輸入");
   System.out.print("請(qǐng)輸入學(xué)號(hào):");
   num1=In.nextInt();
  }
  }
  s[n].num=num1;
  str2=String.valueOf(num1);
  fw.write(str2+" ");
  System.out.println();
  System.out.print("請(qǐng)輸入學(xué)生姓名:");
  s[n].name=In.next();
  fw.write(s[n].name+" ");
  System.out.println();
  System.out.print("請(qǐng)輸入學(xué)生班級(jí):");
  s[n].classAge=In.next();
  fw.write(s[n].classAge+"\r\n");
  ++n;
  fw.close();
  System.out.println();
  System.out.print("是否繼續(xù)添加(Y/N)");
  str=In.next();
  ch=str.charAt(0);
  while(ch!='N'&&ch!='n'&&ch!='Y'&&ch!='y')
  {
  System.out.print("輸入有誤,請(qǐng)重新輸入:");
  str=In.next();
  ch=str.charAt(0);
  }
  if(ch=='N'||ch=='n')
  {
  break;
  }
 }
 System.out.println();
 System.out.print("是否返回主菜單(Y/N)");
 str1=In.next();
 ch1=str1.charAt(0);
 while(ch1!='Y'&&ch1!='y'&&ch1!='N'&&ch1!='n')
 {
  System.out.print("輸入有誤,請(qǐng)重新輸入:");
  str1=In.next();
  ch1=str1.charAt(0);
 }
 if(ch1=='Y'||ch1=='y')
 {
  this.menu();
 }
 if(ch1=='N'||ch1=='n')
 {
  System.out.println("正在退出...謝謝使用!");
  System.exit(0);
 }
 }
 
 public void show()throws IOException
 {
 int i;
 this.judge();
 System.out.println("本次操作共錄入"+n+"位學(xué)生!");
 System.out.println("你錄入的學(xué)生信息如下:");
 System.out.println();
 System.out.println("學(xué)號(hào)\t\t姓名\t班級(jí)");
 for(i=0;i<n;i++)   
 {
  System.out.println(s[i].num+" "+s[i].name+" "+s[i].classAge);
 }
 System.out.println("系統(tǒng)返回主菜單!");
 this.menu();
 }
 
 public void delete()throws IOException//刪除信息功能實(shí)現(xiàn) 注:本功能暫時(shí)不具備可擴(kuò)展性
 {
 this.judge();
 int j=0,t=0,k=0,num1;
 char ch;
 String str;
 Scanner pin=new Scanner(System.in);
 System.out.print("請(qǐng)輸入要?jiǎng)h除的學(xué)號(hào):");
 num1=pin.nextInt();
 for(j=0;j<n;j++)
 {
  if(s[j].num==num1)
  {
  k=1;
  t=j;
  }
 }
 if(k==0)
 {
  System.out.println("對(duì)不起!你要?jiǎng)h除的學(xué)號(hào)不存在!");
  System.out.println("系統(tǒng)將返回主菜單!");
  this.menu();
 }
 if(k==1)
 {
  System.out.println("你要?jiǎng)h除的學(xué)生信息如下:");//打印管理員要?jiǎng)h除的學(xué)生信息
  System.out.println("學(xué)號(hào)\t姓名\t班級(jí)");//本功能暫時(shí)不備擴(kuò)展性
  System.out.println(s[t].num+" "+s[t].name+" "+s[t].classAge);
  System.out.println();
  System.out.print("你確定要?jiǎng)h除(Y/N):");
  str=pin.next();
  ch=str.charAt(0);
  while(ch!='Y'&&ch!='y'&&ch!='N'&&ch!='n')
  {
  System.out.print("輸入有誤,請(qǐng)重新輸入:");
  str=pin.next();
  ch=str.charAt(0);
  }
  if(ch=='N'||ch=='n')
  {
  System.out.println();
  System.out.println("系統(tǒng)返回主菜單!");
  this.menu();
  }
  if(ch=='Y'||ch=='y')
  {
  for(j=t;j<n-1;j++)
  {
   s[j]=s[j+1];
  }
  n--;
  System.out.println("數(shù)據(jù)成功刪除!");
  System.out.println("系統(tǒng)返回主菜單!");
  this.menu();
  }
 }
 }
 
 public void look()throws IOException
 {
 FileReader fr=new FileReader("F://javaFile//student.txt");
 int a;
 while((a=fr.read())!=-1)
 {
  System.out.print((char)a);
 }
 fr.close();
 System.out.println("系統(tǒng)返回主菜單!");
 System.out.println();
 this.menu();
 }
 
 public void modif()throws IOException
 {
 this.judge();
 int j=0,t=0,k=0,num2,num3,moi,c=1;
 char ch;
 String str,str1,str2;
 Scanner pin=new Scanner(System.in);
 System.out.print("請(qǐng)輸入要修改的學(xué)號(hào):");
 num2=pin.nextInt();
 for(j=0;j<n;j++)
 {
  if(s[j].num==num2)
  {
  k=1;
  t=j;
  }
 }
 if(k==0)
 {
  System.out.println("對(duì)不起!你要修改的學(xué)號(hào)不存在!");
  System.out.println("系統(tǒng)將返回主菜單!");
  this.menu();
 }
 if(k==1)
 {
  System.out.println("你要修改的學(xué)生信息如下:");//打印管理員要?jiǎng)h除的學(xué)生信息
  System.out.println("學(xué)號(hào)\t姓名\t班級(jí)");//本功能暫時(shí)不備擴(kuò)展性
  System.out.println(s[t].num+" "+s[t].name+" "+s[t].classAge);
  System.out.println();
  System.out.print("你確定要修改(Y/N):");
  str=pin.next();
  ch=str.charAt(0);
  while(ch!='Y'&&ch!='y'&&ch!='N'&&ch!='n')
  {
  System.out.print("輸入有誤,請(qǐng)重新輸入:");
  str=pin.next();
  ch=str.charAt(0);
  }
  if(ch=='N'||ch=='n')
  {
  System.out.println();
  System.out.println("系統(tǒng)返回主菜單!");
  this.menu();
  }
  while(c==1)
  {
  if(ch=='Y'||ch=='y')
  {
   System.out.println("****************************************");
   System.out.println("*****  1.修改學(xué)號(hào)  *****");
   System.out.println("*****  2.修改班級(jí)  *****");
   System.out.println("*****  3.修改姓名  *****");
   System.out.println("****************************************");
   System.out.print("請(qǐng)選擇:");
   moi=pin.nextInt();
   switch(moi)
   {
   case 1:System.out.print("請(qǐng)輸入新的學(xué)號(hào):");num3=pin.nextInt();s[t].num=num3;break;
   case 2:System.out.print("請(qǐng)輸入新的班級(jí):");str1=pin.next();s[t].classAge=str1;break;
   case 3:System.out.print("請(qǐng)輸入新的姓名:");str2=pin.next();s[t].name=str2;break;
   }
   System.out.println("數(shù)據(jù)已成功修改!");
  }
  System.out.print("是否繼續(xù)修改(Y/N)");
  str=pin.next();
  ch=str.charAt(0);
  System.out.println();
  while(ch!='Y'&&ch!='y'&&ch!='N'&&ch!='n')
  {
   System.out.print("輸入有誤,請(qǐng)重新輸入:");
   str=pin.next();
   ch=str.charAt(0);
  }
  if(ch=='N'||ch=='n')
  {
   break;
  }
  }
 }
 System.out.println();
 System.out.println("系統(tǒng)返回主菜單!");
 this.menu();
 }
 
 public static void main(String[] args)throws IOException
 {
 Student stu=new Student();
 for(int i=0;i<2;i++)
 {
  s[i]=new Student();
 }
 stu.menu();
 }
}

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持服務(wù)器之家。

原文鏈接:http://blog.csdn.net/u010885095/article/details/38848235

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 污片在线观看视频 | 最新国产毛片 | 亚洲第一页中文字幕 | 欧美性生交大片 | 免费看成年人视频在线 | 成人三级电影网站 | 欧美日韩亚洲国产精品 | 亚洲一区二区三区日本久久九 | 精品视频 久久久 | 久久亚洲美女视频 | 国产精品久久久久久久久久 | 久久线视频| 日韩大片在线永久观看视频网站免费 | 国产乱淫av片免费 | 久久国产精品二区 | 成人乱人乱一区二区三区 | 日本视频在线播放 | 国产一级一片免费播放 | 视频一区二区久久 | 性欧美极品xxxx欧美一区二区 | wwwav国产| 国产手机av在线 | 国产午夜小视频 | 国产成人精品区 | 99ri精品 | 精品国产精品久久 | 神马顶级推理片免费看 | 精品国产91久久久久久浪潮蜜月 | 欧美国产一区二区三区 | 欧美一级免费在线观看 | 成人毛片免费播放 | 久久久久亚洲美女啪啪 | 黄色大片网站在线观看 | 国产精品久久久久久久久久iiiii | 成人午夜看片 | 美女扒开腿让男生桶爽网站 | 免费淫视频| 国产艳妇av视国产精选av一区 | 免费小毛片 | 久精品久久 | 国产一区二区久久精品 |