版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、(完整 word 版)java 学生系统源代码编辑整理:尊敬的读者朋友们:这里是精品文档编辑中心, 本文档内容是由我和我的同事精心编辑整理后发布的, 发布之前我们 对文中内容进行仔细校对,但是难免会有疏漏的地方,但是壬然希望(完整word版)java学生 系统源代码)的内容能够给您的工作和学习带来便利。同时也真诚的希望收到您的建议和反馈, 这将是我们进步的源泉,前进的动力。本文可编辑可修改,如果觉得对您有帮助请收藏以便随时查阅,最后祝您生活愉快业绩进步,以 下为(完整word版)java学生系统源代码的全部内容。import javao io.Serializable。pub Iic clas
2、s Course impIements Ser ial izable pr i vate Str i ng courseName pr i vate int courseGradeoCourse() courseName二nu丨I。courseGrade二0.(pub Iic void setCourseNameVaIue (Str ing ss thi So courseName二ss。pub Iic void setCourseGradeVaIue(int ddth i s courseGradeddopub Iic Str i ng getCourseNameVaIue( return
3、thi s .courseName.pub Iic int getCourseGradeValue(return this。courseGradeopub Ii c boo lean equaIs (Object o i f (o二二null return fa Iseoe I se i f (o i nstanceof Course Course rec二(Course) o。if (thiSo courseNameo equaIs (rec getCourseNameVaIue() return true return false。 import java io。Ser i a I i z
4、abIeoimport java.util。ArraySoimport javaoutil。LinkedList。import javaoutil。List。pub Ii c class Student implements Serial izable, Comparable pr i vate Str i ng studentName。pr i vate int studentld。/pr i vate i nt studentCourseAmount二4.pr i vate LinkedLi st courseLi st Student (studentName二nulI。student
5、Id=0ocourseL i st二new L i nkedL i st(。pub I i c vo i d setStudentNameVa I ue (Str i ng name)/确定学生名称thi So studentName二name。(pub I ic void setStudent IdVaIue (int id/确定学生学号this student Id二id。pub I ic void setStudentCourseL i st (L i nkedL i st list)/传入课程链listth i s. courseL i st二I i st。/ Systemo out
6、o pr int In (n例:0916张磊 语文98数学67” .pub I ic void setCourseGrade (Object o/将与学科o同名的学科的成绩改为o的 成绩for (int i=0o ithis.courseList size(。i+ Course obj=new Course (oobj= (Course this。courseList get(i)。if (objo equaIs(o) Course res= (Courseo.obj o setCourseGradeVaIue (res .getCourseGradeVaIue( pub I i c Str
7、i ng getStudentNameVa I ue ( /取得学生姓名return thi sostudentName。pub I i c i nt getStudent I d (/取得学生学号return th i s.studentld。(pub I i c L i nkedL i st getstudentCourseLi st (/得到成绩链的首地址return this.courseList pub I ic long getStudentCourseGrade (Course o/取得与o同名的成绩值,尚有错 误long temp = 0。List courTemp二this。
8、getstudentCourseList(。Course objo/System. out. pr i nt In (courTemp indexOf (o)。int i二courTemp indexOf (oobj二(CoursecourTemp.get (i。temp=obj o getCourseGradeVaIue (oreturn temp.pub I ic boolean equa I s (Object o/判定两个对象是否相同,姓名或学号相同i f (o null) return fa Iseoe I se i f (o instanceof Student Student r
9、ec二(Studento。System. out. pr intln(rec getStudentNameValue(。i f (th i s o studentName. equaIs ( rec getStudentNameVaIue ( th i s. studentIdrecogetStudent Id ()return true return false。pub Ii c int compareTo (Ob ject 0Student obj= (Student 0.i nt th i sSum=0ofor (int i二0。ithis.courseList。size(。i+ Cou
10、rse cour=(Course) thiscourseList. get (iothisSum+二cour.getCourseGradeVaIue (i nt 0Sum=0ofor (int i二0。iobj。getstudentCourseList(。size(i+ Course cour= (Courseobj。getstudentCourseList()。get (i。OSum += cour.getCourseGradeVaIue(。if (thisSumOSumreturn 1oIif (thisSum) 0Sum(return 1。return 0.import javaoawt
11、. Coloroimport java.awt。Font.import java io。BufferedReadero/import java. util.*。import java io。Fi IeNotFoundException。import javaoio. Fi IeOutputStreamoimport javaoio。Fi IeWr iter。import java io。lOException.import java io. InputStreamReader.import javaoio. Pr intWr iteroimport java io.Ser ia IizabIe
12、 import javaosqIoDate。import java text。Deci ma I Format。import java text。NumberFormat。import java utiI. Arraysoimport javaout i I LinkedList.import java util.Li st。import javaoutil.Seanner。import javaoutil *import org.jfree chart ChartFactory.import org. jfree chart ChartFrame。import org。jfree.chart
13、 ChartUtil ities import org.jfree chart JFreeChartoimport org。jfree。chart.axis。CategoryAx i soimport org。jfree.chart。ax i s NumberAx i soimport org。jfree chart。labels StandardP i eSect i onLabeI Generator。import org。jfree.chart plot.CategoryPlot import org.jfree。chart plot.PiePIot。import org.jfree。c
14、hart。plot.PlotOrientation。import org。jfreeochart。titie.TextTitle。import org.jfree。data。category. DefauItCategoryDatasetoimport org.jfree。data.genera IoDefauItPieDataset。pub Iic class Teacher pr i vate Str i ng teacherNameopr i vate List studentList Teacher( teacherName二nuI I。studentLi st二new LinkedL
15、i st(。1pub Ii c void setTeacherName (String name thi s teacherName二name。pub Ii c void setStudentList (LinkedL i st Ii stthi So studentList二list。pub Iic Str i ng getTeacherName(return thi s teacherNameopub Iic List getStudentList ( return thi sostudentList。pub I ic void addStudent (Object o/添加学生o /Da
16、te date二new Date (0)。if (o!=nul I & (o instanceof Student)studentList。add (o/* Str ing s = null.try Fi leWr iter fw = new Fi leWr iter (nmanager Iog. true)oPr intWr iter log = newPr intWriter (fw。I og. pr i nt In (”- / log.print In (this。getTeacherName ()。Student stu二(Student o。log. pr intln(添加学
17、生。I og. pr i nt I n(学号:” +stu。getStudent Id (+” 姓名:”getStudentNameVaIue(。log. pr i nt I n (=二”+new Date ( 0+= ologo flush(.log. close(。 catch (lOException e e.pr i ntStackTrace(。 */pub Iic void toAddStudent (Scanner tempCourseSystemo out. pri nt In(”输入要添加学生的学号,姓名,各科名称及成绩 分开“oSystem, out. pr i nt I n
18、 (n例:09001朱良 语文2345英语78”。InputStreamReader i sr = new InputStreamReader (System. in.BufferedReader br二new BufferedReader (i sr)。Str ing s二nuI I。try s = br. readL i ne(。tempCourse二new Scanner(s Student stu二new Student(。i f (tempCourse. hasNextI nt() i nt stuId = tempCourseo next I nt(。i f (tempCourse
19、. hasNext(String stuName二tempCourse。next(。stu.setStudentNameVaIue(stuNameostUo setStudentIdVaIue(stuIdoLinkedL i st objLi st二new LinkedLi st(。StringcourseName二 courseGrade=0oCourse objCourse wh i Ie (tempCourse。hasNext(tempCourse. hasNextI nt( courseName二tempCourse。next(。courseGrade二tempCour
20、se nex11 nt(。+stUo以空格数学objCourse二new Course (oobjCourseo setCourseNameVaIue(courseNameobjCourse setCourseGradeVaIue (courseGrade)oobjLi stadd (objCourse)o(stu setStudentCourseList (objLi k=0ofor (int j二0。jthis。studentList。size(。j+ Studentcc= (Student this studentList。get(j。i f (cco getStudent
21、I d (stu. getStudent I d ( k+。if (k二二0 th i So addStudent (stuoSystemo out。pr i nt I n(添加成功”。 elseSystem, outo pr i nt I n(”已存在该学号”.this,toAddStudent (tempCourseo elseSystemo out。pr i nt I n (n错误输入”.th i s.toAddStudent(tempCourse。e I se System, out. pr i nt I n (”错误输入。th i s. toAddStudent(tempCourse
22、ocatch (lOException e e.pr i ntStackTrace()。final Iy try br. c I ose (ocatch (lOExcept i on ee.pr i ntStackTrace(opub I ic void removeStudent ( int id/删除学号与id相同的对象i nt i ndex=1ofor (int i=0。ithis studentListo size(i+Student temp=(Studentthis。studentList。get(ioif (temp. getStudentId() = idi ndex=ioIi
23、f (index ! = 1 Student stu= (Student this studentList get(index)。th i So studentL i st。remove (i ndexoSystemo out。pr i nt I n(删除成功。/*Str ing s二nul I。try (Fi leWr iter fw二new Fi leWr iter (nmanagerolog”, true PrintWriter log二newPrintWriter (fw。Iog. pr i nt In (”-/logo pr i ntin (this。getTeacherName(。
24、/ Student stu= (StudentooI ogo pr i nt I n (”删除学生” 。I og. pr i nt I n (”学号:+stuogetStudent Id (+”+姓名:getStudentNameVa I ue (.I ogo pr i nt I n(二二=+new Date (0+n=二olog. f lush() o logo close(o catch (lOException e) eopr i ntStackTrace (oI */Systemo out。print In (”不存在该学生乃 。this toRemoveStudent(。pub Ii
25、c void toRemoveStudent(Systemo out. pr intln (”输入要删除学生的学号” 。InputStreamReader i sr二new InputStreamReader (System。inBufferedReader br = newBufferedReader(i sr)oStr ing s = nulIotry s二br。readLine(。Seanner tempCourse二new Seanner(soi f (tempCourseo hasNextI nt()i nt stuld二tempCourseo next Int(。th i s. r
26、emoveStudent (stuIdelse Systemo out。print In(错误输入。th i s. toRemoveStudent ()n+stUo/ int stuId二tempCourseonext I nt (/ thiso removeStudent (stuld。 catch (lOException e e。pr i ntStackTrace( finally try br.close ()。 catch (lOException e e.pr i ntStackTrace(。pub I ic void changeStudent (Studen t o/与o学号或
27、姓名一样的学生对象用o替代int index二0。for (int i二0. ith i s studentList.size( 。i+ Student temp二(Studentthis studentList get (ioif (temp o getStudentId (二二o. getStudentId (| Itemp. getStudentNameValue(。equaIs (oGgetStudentNameValue(i ndex=iobreako11Student stu= (Studentthis。studentList。get (index。thi So studentLi
28、sto set (index,。/* Str ing s = null。try Fi leWr iter fw = new Fi leWr iter (nmanager. Iog, true)。Pr intWriter log = new Pr intWriter(fwI og. pr i nt I n (”-。/log.print In (this。getTeacherName (o/Student stu二(Student) oolog. pr intln(修改学生信息” 。I og. pr i nt I n (学号:” +stu。getStudent Id ( +”+” 姓名:n+stu
29、. getStudentNameVa I ue(。I ogo pr i nt I n (=n+new Date (0) + =olog. flush (olog. close(o catch (lOException e e.pr i ntStackTrace(。 */pub Iic void toChangeStudent(System, out. pr i nt I n (输入要修改的学生的学号,姓名,各科名称及成绩以空格分 开.Systemoout. pr i nt I n (n例:09001朱良 语文23数学45英语78”。InputStreamReader i sr = new In
30、putStreamReader (System。in。BufferedReader br二new BufferedReader (i sroStr ing s二nuI I。try s二br。readLine(。Scanner tempCourse二new Seanner (sStudent stu二new Student (.int stuId二tempCourse .next I nt(String stuName = tempCourse.next(。stu。setStudentNameVaIue (stuNameostu.setStudent IdVaIue(stuId) LinkedL
31、ist objLi st=new LinkedLi st(。String courseName二 courseGrade二0。Course objCourse。while (tempCourse hasNext( | tempCourseohasNextInt(courseName二tempCourse next( courseGrade二tempCourse next I nt ( objCourse二new Course(。objCourseo setCourseNameVaIue (courseName)。objCourseosetCourseGradeVaIue (co
32、urseGrade)。objLi st。add (objCourse。stu.setStudentCourseList(objListthis changeStudent (stu。 catch (lOException e e。pr intStackTrace()o finallytry br. close()。 catch (lOException e e.pr i ntStackTrace (pub I ic void searchStudentBy I d(/查找学号为id的学生的信息学号,姓名,各 科成绩)Sys tem. out. pr i n tin C输入学号:n.Seanne
33、r sc二new Seanner (S id二sc.next I nt(。int index二0。for (int匚二0 ithis.studentLi st。size( 。i+ Student temp二(Student this。studentList。get(i)。if (temp. getStudent Id(=idi ndex二ioStudent sss= (Studentthis .studentList. get(index。System, outo printing姓名:H+sss. getStudentNameVaIue () +”.System。ou
34、t. pr intln(”学号:n+sss。getStudentld (+HnLinkedLi st cour=new LinkedLi st(。cour=ssso getstudentCourseL i st(ofor (int i=0。icour。size(。i+Course tempCourse二new Course(otempCourse=(Course) cour. get (iSystemoout .print In ( tempCourseogetCourseNameVaIue ( +” :”+tempCourse。getCourseGradeVaIue() +”。pub I i
35、c void courseAverage ()/计算单科平均分Systemo out。pr i nt I n (n输入课程名”Course o二new Course()Seanner sc = new Seanner (System. in。String ss二sc。next()。Oo setCourseNameVaIue (ss。long sum=0ofor (int i二0。ithis.studentList size (oi+ Student tempStu二(Student this。studentList。get(i。sum二sum+tempStu。getStudentCourseG
36、rade(o。doubIe aver二(doubIe) sum/thisostudentList。size(。System。out。pr i nt In (averopub I ic void makeOrderByGrades ( /将学生信息按总成绩从小到大打印到控制台上Object stuArray二th i s .studentList。toArray (oArrays sort (stuArrayofor (int i=0. istuArray。Iengtho i+Student tempStu= (Student) stuArrayi.System. out. pr i nt(te
37、mpStUo getStudent Id (+”n。System. out。pr i nt (tempStu. getStudentNameVaIue(+n”.LinkedL i st cour=new Li nkedLi st(。cour=tempStu getstudentCourseLi st()。for (int j二0。j cour.get (j。System. out。pr i nt( tempCourseogetCourseNameVaIue (+Hn+tempCourse getCourseGradeVaIue (+nnoSystem. out。pr intln(。pub Ii
38、c void toClear(this.studentList clear(。Str ing s = nulI try Fi leWr iter fw二new Fi leWr iter (Mmanager。log, trueoPrintWriter log二newPrintWriter (fwologo pr intln(this。getTeacherName ( /Student stu二(Studento.logo pr intin (”删除全部学生信息.logo pr i nt In (= +new Date(0+=nologo flushOo log. close () o catch
39、 (lOExcept ion e e.pr i ntStackTrace(。pub I ic void PieChart (/饼形图/ int count二scoreAna(。DefaultPieDataset pieDataset二new DefauItPieDataset(). int count = 0, 0F0, 0,0o/ for(System, outo print In (”输入课程名”。Course o二new Course(。Seanner sc = new Seanner (System。inoStr i ng ss二sc。next (o. setCourseNameVaI
40、ue (ss。/ long sum二0。for (int i=0。ithis studentListo size(。i+Student tempStu= (Student thi s.studentL i st.get ( temp二(int tempStu getStudentCourseGrade(ooif (0二temp& temp60 count 0 +o/不及格人数i f (60=temp & & temp70count 1 +o/及格人数if(70二temp& temp80) count 2 +o/中等人数1if (80二temp&
41、 temp (=100) count 3+./良好人数i f ( 90&tempStu. getStudentCourseGrade (o=100count 4 +o/优秀人数/ for (int jO.jcount, length。j+ / System. out. pr intln(countj。/ pi eDataset o setVa I ue (n优秀打count 0opi eDataset o setVa I ue (n良好” ,count 1 。pieDataset. setVa Iue (n中等” ,count 2opi eDataset o setVa I ue(及格
42、”rcount 3。pi eDataset. setVa I ue (”不及格打count 4 oJFreeChart chart二ChartFactory. createPi eChart3DC饼 形 图pieDataset, true,false, false)。/* * * * *A start* * * */设置标题字体样式charto getTitle()。setFont(new Font(n黑体” ,Font. BOLD, 20./设置饼状图里描述字体样式Pi ePlot pi ePlot二(PiePlot charto getPlot(。p i ePI ot. setLabe I
43、 Font (newFont (”黑体”.Fonto BOLD, 10)。 /设置显示百分比样式pi ePlot。setLabeI Generator (new StandardP i eSect i onLabe I Generator ( (n 0)(2). NumberFormat. getNumberInstance(、new Dec ima I Format (0。00%”o设置统计图背景pi ePloto setBackgroundPa int( Colorowh i te。设置图片最底部字体样式chart. getLegend (.set I temFont (new Font(
44、n黑体乃,FontoBOLD , 10 ./* * * * 夬*头*A end* * * * */try ChartUt i I it ies.wr i teChartAsPNG ( new F iIeOutputStream(np i eChartojpg” ,chart, 400,300o catch (Fi IeNotFoundException e e。pr intStackTrace(。 catch (lOException e e.pr intStackTrace(。final ChartFrame preview = new ChartFrame(H学生成绩情况”rchart)o
45、preview.pack(oprev i ewo setVi s i bIe(trueo/ Labe IFramePi eChart app二new Labe IFramePi eChart (o/ app.setDefauItCIoseOperat i on (JFrameoEX IT ON CL0SEo/ appo setSize ( 450, 350。/apposetVisible( true。-import javaoio.*import java.util。ArraySoimport java utiI.LinkedList。import javaoutil.List。import
46、javaoutil。Scanner。import javax.swing。text.html.HTMLDocument. Iterator。pub Iic class Running pub Iic void start ( throws lOExceptionTeacher objTeacher二new Teacher(。Running run二new Running(。try Ob jectlnputStreami s二new Ob jectlnputStream( newFi IeInputStream (TestObject 10。txt” oLinkedList tempList = (LinkedList is.readObject(。/ 从 流中读取List的数据objTeachero setStudentL i st (Li nkedL i sttempL i st。Object stuArray二tempLi st. toArray(iSo close (o catch (FileNotFoundException e e.pr i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年肉食材料供货合同
- 2024发布网络广告协议
- 仿写:高新技术产业合作开发合同
- 二手设备购销合同范本示例
- 房产交易资金代付协议书
- 工程拆迁安置合同范本
- 2024年合同延期协议补充协议
- 无需担保的施工合同范本
- 鱼塘养殖土地租赁合同
- 2024年物业授权管理合同范本
- 压力管道材料等级表
- 三年级数学上册 加号、减号的来源课外拓素材 冀教版 素材
- 《狼和小羊》PPT课件.ppt
- 神明—EZflame火焰检测系统
- 新《固废法》解读(专业版)
- 个人简历求职简历课件.ppt
- 副神经节瘤图文.ppt
- 业务流程绘制方法IDEF和IDEFPPT课件
- (完整版)垃圾自动分拣机构PLC控制毕业设计.doc
- 小学四年级音乐课程标准
- 我的一次教研经历
评论
0/150
提交评论