日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

java课堂测试样卷-----简易学籍管理系统

發布時間:2023/11/27 生活经验 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java课堂测试样卷-----简易学籍管理系统 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

程序設計思路:分別建立兩個類:ScoreInformation類(用來定義學生的基本信息以及設置set和get函數)ScoreManagement類(用來定義實現學生考試成績錄入,考試成績修改,績點計算等功能的函數)和一個主函數Text類 (通過輸入的數字選項進行功能的實現,因為退出系統代碼量極少,所以在主函數中實現此功能)

程序源代碼及注釋

ScoreInformation類:

 1 //信1805-3 20183658 王兵兵
 2 package adc;
 3 
 4 public class ScoreInformation 
 5 {
 6         private String stunumber;                   //學生學號
 7         private String name;                        //學生姓名
 8         private double mathematicsscore;            //高等數學
 9         private double englishscore;                //大學英語
10         private double networkscore;                //計算機網絡
11         private double databasescore;               //數據庫
12         private double softwarescore;                //軟件工程
13         ScoreInformation(String stunumber,String name,double mathematicsscore,double englishscore,double networkscore,double databasescore, double softwarescore)
14         {  //通過構造函數默認賦值
15             this.stunumber=stunumber;
16             this.name=name;
17             this.mathematicsscore=mathematicsscore;
18             this.englishscore=englishscore;
19             this.networkscore=networkscore;
20             this.databasescore=databasescore;
21             this.softwarescore=softwarescore;
22         }
23         public void setstunumber(String stunumber)              //對學生的學號進行賦值操作
24         {
25             this.stunumber=stunumber;
26         }
27         public void setname(String name)                   //對學生的姓名進行賦值操作
28         {
29             this.name=name;
30         }
31         public void setmathematicsscore(double mathematicsscore)         //對學生的高等數學成績進行賦值操作
32         {
33             this.mathematicsscore=mathematicsscore;
34         }
35         public void setenglishscore(double englishscore)                //對學生的大學英語成績進行賦值操作
36         {
37             this.englishscore=englishscore;
38         }
39         public void setnetworkscore(double networkscore)                 //對學生的計算機網絡成績進行賦值操作
40         {
41             this.networkscore=networkscore;
42         }
43         public void setdatabasescore(double databasescore)             //對學生的數據庫成績進行賦值操作
44         {
45             this.databasescore=databasescore;
46         }
47         public void setsoftwarescore(double softwarescore)             //對學生的軟件工程成績進行賦值操作
48         {
49             this.softwarescore=softwarescore;
50         }
51         public String getstunumber()           //返回學生的學號
52         {
53             return this.stunumber;
54         }
55         public String getname()                  //返回學生的姓名
56         {
57             return this.name;
58         }
59         public double getmathematicsscore()         //返回學生的高等數學成績
60         {
61             return this.mathematicsscore;
62         }
63         public double getenglishscore()               //返回學生的大學英語成績
64         {
65             return this.englishscore;
66         }       
67         public double getnetworkscore()              //返回學生的計算機網絡成績
68         {
69             return this.networkscore;
70         }
71         public double getdatabasescore()              //返回學生的數據庫成績
72         {
73             return this.databasescore;
74         }
75         public double getsoftwarescore()              //返回學生的軟件工程成績
76         {
77             return this.softwarescore;
78         }
79 
80 }

?

ScoreManagement類

  1 package adc;
  2 import java.util.Scanner;
  3 public class ScoreMangerment 
  4 {        
  5          int j=0;
  6         Scanner te=new Scanner(System.in);
  7         ScoreInformation[] SI=new ScoreInformation[100];        //定義一個學生學籍信息的數組
  8         ScoreMangerment() 
  9         {   //利用構造函數初始化5個學生的信息
 10             SI[0]=new ScoreInformation("20183658","王兵兵",0,0,0,0,0);
 11             SI[1]=new ScoreInformation("20183659","張三",0,0,0,0,0);
 12             SI[2]=new ScoreInformation("20183660","李四",0,0,0,0,0);
 13             SI[3]=new ScoreInformation("20183661","王無",0,0,0,0,0);
 14             SI[4]=new ScoreInformation("20183662","李六",0,0,0,0,0);
 15         }
 16         public void meau()           //輸出系統主界面函數
 17         {
 18             System.out.println("********************************************************");
 19             System.out.println("             \t石家莊鐵道大學軟件工程系");
 20             System.out.println("             \t學籍管理系統系統2019版");
 21             System.out.println("********************************************************");
 22             System.out.println("                1、學生考試成績錄入");
 23             System.out.println("                2、學生考試成績修改");
 24             System.out.println("                3、計算學生成績績點");
 25             System.out.println("                4、退出學籍管理系統");
 26             System.out.println("********************************************************");
 27        }
 28         public void scorerecord()                 //功能1:實現學生信息的錄入
 29         {
 30             System.out.println("********************************************************");
 31             System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
 32             System.out.println("             \t考生成績錄入");
 33             System.out.println("********************************************************");
 34             System.out.println("                請輸入考生學號:");
 35             System.out.println("********************************************************");
 36              while(!getanswer())      //用來保證學生的輸入的學號存在,否則一直輸入,直到輸入學生學號存在為止
 37              {
 38                  System.out.println("你輸入的學號有誤或不存在!");
 39                  System.out.println("********************************************************");
 40                  System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
 41                  System.out.println("             \t考生成績錄入");
 42                  System.out.println("********************************************************");
 43                  System.out.println("                請輸入考生學號:");
 44                  System.out.println("********************************************************");
 45              }
 46              scoreluruPrint1(j);
 47              while(!pandun1())      //輸入Y或N時對應的程序操作
 48              {
 49                  scoreluruPrint1(j);      //輸入N返回錄入界面
 50              }
 51              meau();            //輸入Y后返回主界面
 52         }
 53         public Boolean getanswer()     //檢查學號是否存在
 54         {   
 55             String a=te.next();
 56             Boolean temp=false;
 57             for(int i=0;i<5;i++)
 58             {  
 59                 if(a.equals(SI[i].getstunumber()))
 60                 {
 61                     temp=true;
 62                     j=i;
 63                     break;
 64                 }
 65             }
 66             return temp;
 67         }
 68         public void scoreluruPrint1(int j)                    //實現學生成績信息的輸入,并且在輸入完一科成績后進行學生信息的更新
 69         {   
 70              System.out.println("********************************************************");
 71              System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
 72              System.out.println("             \t考生成績錄入");
 73              System.out.println("********************************************************");
 74              System.out.println("                學生學號:"+SI[j].getstunumber());
 75              System.out.println("                學生姓名:"+SI[j].getname());
 76              System.out.println("                請輸入高等數學成績:");
 77              System.out.println("********************************************************");
 78              SI[5]=new ScoreInformation(" "," ",0,0,0,0,0);
 79              SI[5].setstunumber(SI[j].getstunumber());
 80              SI[5].setname(SI[j].getname());
 81              double temp1=te.nextDouble();
 82              SI[5].setmathematicsscore(temp1);
 83              System.out.println("********************************************************");
 84              System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
 85              System.out.println("             \t考生成績錄入");
 86              System.out.println("********************************************************");
 87              System.out.println("                學生學號:"+SI[5].getstunumber());
 88              System.out.println("                學生姓名:"+SI[5].getname());
 89              System.out.println("                高等數學成績 :"+SI[5].getmathematicsscore());
 90              System.out.println("                請輸入大學英語成績:");
 91              System.out.println("********************************************************");
 92              double temp2=te.nextDouble();
 93              SI[5].setenglishscore(temp2);
 94              System.out.println("********************************************************");
 95              System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
 96              System.out.println("             \t考生成績錄入");
 97              System.out.println("********************************************************");
 98              System.out.println("                學生學號:"+SI[5].getstunumber());
 99              System.out.println("                學生姓名:"+SI[5].getname());
100              System.out.println("                高等數學成績 :"+SI[5].getmathematicsscore());
101              System.out.println("                大學英語成績:"+SI[5].getenglishscore());
102              System.out.println("                請輸入計算機網絡成績:");
103              System.out.println("********************************************************");
104              double temp3=te.nextDouble();
105              SI[5].setnetworkscore(temp3);
106              System.out.println("********************************************************");
107              System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
108              System.out.println("             \t考生成績錄入");
109              System.out.println("********************************************************");
110              System.out.println("                學生學號:"+SI[5].getstunumber());
111              System.out.println("                學生姓名:"+SI[5].getname());
112              System.out.println("                高等數學成績 :"+SI[5].getmathematicsscore());
113              System.out.println("                大學英語成績:"+SI[5].getenglishscore());
114              System.out.println("                計算機網絡成績:"+SI[5].getnetworkscore());
115              System.out.println("                請輸入數據庫成績:");
116              System.out.println("********************************************************");
117              double temp4=te.nextDouble();
118              SI[5].setdatabasescore(temp4);
119              System.out.println("********************************************************");
120              System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
121              System.out.println("             \t考生成績錄入");
122              System.out.println("********************************************************");
123              System.out.println("                學生學號:"+SI[5].getstunumber());
124              System.out.println("                學生姓名:"+SI[5].getname());
125              System.out.println("                高等數學成績 :"+SI[5].getmathematicsscore());
126              System.out.println("                大學英語成績:"+SI[5].getenglishscore());
127              System.out.println("                計算機網絡成績:"+SI[5].getnetworkscore());
128              System.out.println("                數據庫成績:"+SI[5].getdatabasescore());
129              System.out.println("                請輸入軟件工程成績:");
130              System.out.println("********************************************************");
131              double temp5=te.nextDouble();
132              SI[5].setsoftwarescore(temp5);
133              System.out.println("********************************************************");
134              System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
135              System.out.println("             \t考生成績錄入");
136              System.out.println("********************************************************");
137              System.out.println("                學生學號:"+SI[5].getstunumber());
138              System.out.println("                學生姓名:"+SI[5].getname());
139              System.out.println("                高等數學成績 :"+SI[5].getmathematicsscore());
140              System.out.println("                大學英語成績:"+SI[5].getenglishscore());
141              System.out.println("                計算機網絡成績:"+SI[5].getnetworkscore());
142              System.out.println("                數據庫成績:"+SI[5].getdatabasescore());
143              System.out.println("                軟件工程成績:"+SI[5].getsoftwarescore());
144              System.out.println("           該學生生成績已錄入完畢,是否提交(Y/N)");
145              System.out.println("********************************************************");
146         }
147         public Boolean pandun1()     //輸入Y或N并返回Boolean值
148         {
149             String temp6=te.next();
150             if(temp6.equals("Y"))
151             {
152                 SI[j]=SI[5];
153                 return true;
154             }
155             else
156             {
157                 return false;
158             }
159         }
160         public void modifyscore()      //功能2:實現學生成績的修改
161         {
162             System.out.println("********************************************************");
163             System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
164             System.out.println("             \t考生成績修改界面");
165             System.out.println("********************************************************");
166             System.out.println("                請輸入考生學號:");
167             System.out.println("********************************************************");
168              while(!getanswer())          //通過while 判斷輸入的學號是否存在
169              {
170                  System.out.println("你輸入的學號有誤或不存在!");
171                  System.out.println("********************************************************");
172                  System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
173                  System.out.println("             \t考生成績修改界面");
174                  System.out.println("********************************************************");
175                  System.out.println("                請輸入考生學號:");
176                  System.out.println("********************************************************");
177              }
178              System.out.println("********************************************************");         //輸出學生的全部信息
179              System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
180              System.out.println("             \t考生成績錄入");
181              System.out.println("********************************************************");
182              System.out.println("                學生學號:"+SI[j].getstunumber());
183              System.out.println("                學生姓名:"+SI[j].getname());
184              System.out.println("              1、高等數學成績 :"+SI[j].getmathematicsscore());
185              System.out.println("              2、大學英語成績:"+SI[j].getenglishscore());
186              System.out.println("              3、計算機網絡成績:"+SI[j].getnetworkscore());
187              System.out.println("              4、數據庫成績:"+SI[j].getdatabasescore());
188              System.out.println("              5、軟件工程成績:"+SI[j].getsoftwarescore());
189              System.out.println("********************************************************");
190              modifyspecialscore();    //修改成績
191              System.out.println("********************************************************");
192              System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
193              System.out.println("             \t考生成績錄入");
194              System.out.println("********************************************************");
195              System.out.println("                學生學號:"+SI[6].getstunumber());
196              System.out.println("                學生姓名:"+SI[6].getname());
197              System.out.println("               1、高等數學成績 :"+SI[6].getmathematicsscore());
198              System.out.println("               2、大學英語成績:"+SI[6].getenglishscore());
199              System.out.println("               3、計算機網絡成績:"+SI[6].getnetworkscore());
200              System.out.println("               4、數據庫成績:"+SI[6].getdatabasescore());
201              System.out.println("               5、軟件工程成績:"+SI[6].getsoftwarescore());
202              System.out.println("           該學生生成績已錄入完畢,是否提交(Y/N)");
203              System.out.println("********************************************************");
204              while(!pandun2())
205              {
206                  modifyscore() ;
207              }
208               meau();
209         }
210        public void modifyspecialscore()      //修改選定的成績
211        {
212            SI[6]=new ScoreInformation(" "," ",0,0,0,0,0);
213            SI[6]=SI[j];
214            System.out.println("請輸入你要修改的成績對應的數字選項:");
215            int temp7=te.nextInt();
216            if(temp7==1)
217            {
218              System.out.println("********************************************************");
219                System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
220                System.out.println("             \t考生成績錄入");
221                System.out.println("********************************************************");
222                System.out.println("                學生學號:"+SI[j].getstunumber());
223                System.out.println("                學生姓名:"+SI[j].getname());
224                System.out.println("            請輸入修改后高等數學成績 :");
225                System.out.println("********************************************************");
226                double index1=te.nextDouble();
227                SI[6].setmathematicsscore(index1);
228            }
229            else if(temp7==2)
230            {
231              System.out.println("********************************************************");
232                System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
233                System.out.println("             \t考生成績錄入");
234                System.out.println("*******************************************************");
235                System.out.println("                學生學號:"+SI[j].getstunumber());
236                System.out.println("                學生姓名:"+SI[j].getname());
237                System.out.println("            請輸入修改后大學英語成績 :");
238                System.out.println("********************************************************");
239                double index2=te.nextDouble();
240                SI[6].setenglishscore(index2);
241            }
242            else if(temp7==3)
243            {
244              System.out.println("********************************************************");
245                System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
246                System.out.println("             \t考生成績錄入");
247                System.out.println("*******************************************************");
248                System.out.println("                學生學號:"+SI[j].getstunumber());
249                System.out.println("                學生姓名:"+SI[j].getname());
250                System.out.println("            請輸入修改后計算機網絡成績 :");
251                System.out.println("********************************************************");
252                double index3=te.nextDouble();
253                SI[6].setnetworkscore(index3);
254            }
255            else if(temp7==4)
256            {
257              System.out.println("********************************************************");
258                System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
259                System.out.println("             \t考生成績錄入");
260                System.out.println("*******************************************************");
261                System.out.println("                學生學號:"+SI[j].getstunumber());
262                System.out.println("                學生姓名:"+SI[j].getname());
263                System.out.println("            請輸入修改后數據庫成績 :");
264                System.out.println("********************************************************");
265                double index4=te.nextDouble();
266                SI[6].setdatabasescore(index4);
267            }
268            else if(temp7==5)
269            {
270              System.out.println("********************************************************");
271                System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
272                System.out.println("             \t考生成績錄入");
273                System.out.println("*******************************************************");
274                System.out.println("                學生學號:"+SI[j].getstunumber());
275                System.out.println("                學生姓名:"+SI[j].getname());
276                System.out.println("            請輸入修改后軟件工程成績 :");
277                System.out.println("********************************************************");
278                double index5=te.nextDouble();
279                SI[6].setsoftwarescore(index5);
280            }
281        }
282        public Boolean pandun2()         //輸入Y或N并返回Boolean值
283        {
284            String temp8=te.next();
285            if(temp8.equals("Y"))
286            {
287                SI[j]=SI[6];
288                return true;
289            }
290            else
291            {
292                return false;
293            }
294        }
295        public void calulatescorepoint()        //功能3:計算學生考試成績對應的績點
296        {
297         System.out.println("********************************************************");
298         System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
299         System.out.println("             \t學生考試成績績點計算界面");
300         System.out.println("********************************************************");
301         System.out.println("                      請輸入考生學號:");
302         System.out.println("********************************************************");
303            while(!getanswer())
304            {
305                System.out.println("你輸入的學號有誤或不存在!");
306                System.out.println("********************************************************");
307                System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
308                System.out.println("             \t考生成績錄入");
309                System.out.println("********************************************************");
310             System.out.println("                  請輸入考生學號:");
311             System.out.println("********************************************************");
312        }
313            System.out.println("********************************************************");
314            System.out.println("    \t石家莊鐵道大學軟件工程系學籍管理2019版");
315            System.out.println("           \t學生成績績點計算界面");
316            System.out.println("********************************************************");
317            System.out.println("                   學生學號:"+SI[j].getstunumber());
318            System.out.println("                   學生姓名:"+SI[j].getname());
319            System.out.println("              1、高等數學成績 :"+SI[j].getmathematicsscore());
320            System.out.println("              2、大學英語成績:"+SI[j].getenglishscore());
321            System.out.println("              3、計算機網絡成績:"+SI[j].getnetworkscore());
322            System.out.println("              4、數據庫成績:"+SI[j].getdatabasescore());
323            System.out.println("              5、軟件工程成績:"+SI[j].getsoftwarescore());
324             concullate();
325            System.out.println("                是否返回主界面(Y/N)");
326            System.out.println("********************************************************");
327            pandun3();
328        }
329        public void concullate()           //判斷學生績點是否滿足畢業要求
330        {   double sum=0;
331            sum+=scorepoint(SI[j].getmathematicsscore())*5.0;
332            sum+=scorepoint(SI[j].getenglishscore())*3.0;
333            sum+=scorepoint(SI[j].getnetworkscore())*4.0;
334            sum+=scorepoint(SI[j].getdatabasescore())*3.0;
335            sum+=scorepoint(SI[j].getsoftwarescore())*4.0;
336            sum=sum/19;
337            String result=String.format("%.2f", sum);
338            System.out.println("           你的平均學分績點為:"+result);
339            if(sum>=2.0)
340                System.out.println("     提示信息:你的學分績點已達到畢業要求!");
341            else
342                System.out.println("     提示信息:你的學分績點不滿足畢業要求!");
343        }
344        public double scorepoint(double sdc)          //返回學生成績對應的績點
345        {  
346            double index0=0;
347         if(sdc<60)
348         {
349             index0=0;
350         }
351         else if(sdc>=60&&sdc<=63.9)
352         {
353             index0=1.0;
354         }
355         else if(sdc>=64&&sdc<=65.9)
356         {
357             index0=1.5;
358         }
359         else if(sdc>=66&&sdc<=67.9)
360         {
361             index0=1.7;
362         }
363         else if(sdc>=68&&sdc<=71.9)
364         {
365             index0=2.0;
366         }
367         else if(sdc>=72&&sdc<=74.9)
368         {
369             index0=2.3;
370         }
371         else if(sdc>=75&&sdc<=77.9)
372         {
373             index0=2.7;
374         }
375         else if(sdc>=78&&sdc<=81.9)
376         {
377             index0=3.0;
378         }
379         else if(sdc>=82&&sdc<=84.9)
380         {
381             index0=3.3;
382         }
383         else if(sdc>=85&&sdc<=88.9)
384         {
385             index0=3.7;
386         }
387         else
388             index0=4.0;
389         return index0;
390        }
391        public void pandun3()            //輸入Y或N后進行相應的操作
392     {
393         String temp9=te.next();
394         if(temp9.equals("Y"))
395         {
396             meau();
397         }
398         else;
399     }
400 }

?

主函數

 1 package adc;
 2 import java.util.*;
 3 public class Text {
 4 
 5     public static void main(String[] args) 
 6     {
 7         Scanner input=new Scanner(System.in);
 8         ScoreMangerment SM=new ScoreMangerment();
 9         SM.meau();                  //顯示系統主界面
10         while(true)
11         {
12             int a=input.nextInt();
13             if(a==1)
14             {
15                 SM.scorerecord();        //調用成績錄入函數
16                 
17             }
18             else if(a==2)
19             {
20                 SM.modifyscore();    //調用成績修改函數
21             }
22             else if(a==3)
23             {
24                 SM.calulatescorepoint();     //調用計算學生績點函數
25             }
26             else if(a==4)             //退出系統
27             {
28                 System.out.println("********************************************************");
29                 System.out.println("             \t石家莊鐵道大學軟件工程系學籍管理2019版");
30                 System.out.println("             \t制作人:王兵兵");
31                 System.out.println("********************************************************");
32                 break;
33             }
34             else      //防止輸入的選項不存在
35             {
36                 System.out.println("該選項不存在!");
37                 SM.meau();
38             }
39         }
40         input.close(); 
41     }
42     
43 }

?

心得體會:在寫復雜且代碼量龐大的程序時,一定要保證自己的邏輯思維清楚,一旦混亂,就會條理不清,調試尋找代碼錯誤就會花費很長時間,所以邏輯思維很重要。

再者自己要保持良好的心態,一定要把題讀懂讀透,不要看一遍題后就立即開始做,先構造下自己的思路和框架。

最后就是基本功不扎實:對鍵盤不熟悉,敲代碼的速度過慢以及準確率低,日后要多加練習。

轉載于:https://www.cnblogs.com/weixiao1717/p/11506441.html

總結

以上是生活随笔為你收集整理的java课堂测试样卷-----简易学籍管理系统的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。