欢迎来到天天文库
浏览记录
ID:51008576
大小:43.00 KB
页数:6页
时间:2020-03-17
《用java编写的学生成绩管理系统代码.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、//studentimportjava.sql.*;publicclassStudent{privateStringid;privateStringname;privateintmath;privateintenglish;privateintjava;privateintcomputer;publicStringgetId(){returnid;}publicvoidsetId(Stringid){this.id=id;}publicStringgetName(){returnname;}publicvoidsetName(Stringname){this.name
2、=name;}publicintgetMath(){returnmath;}publicvoidsetMath(intmath){this.math=math;}publicintgetEnglish(){returnenglish;}publicvoidsetEnglish(intenglish){this.english=english;}publicintgetJava(){returnjava;}publicvoidsetJava(intjava){this.java=java;}publicintgetComputer(){returncomputer;}p
3、ublicvoidsetComputer(intcomputer){this.computer=computer;}publicstaticvoidmain(String[]args)throwsException{Stringid;Stringcid;Stringname;intmath;intenglish;intjava;intcomputer;StringDBDriver="sun.jdbc.odbc.JdbcOdbcDriver";StringconStr="jdbc:odbc:student";Connectioncon=null;Statementstm
4、t=null;ResultSetrs=null;Class.forName(DBDriver);con=DriverManager.getConnection(conStr,"student","123");stmt=con.createStatement();Strings="ttt学生成绩tt1新增tt2更改tt3删除tt4查找tt5显示tt0退出";System.out.print(s);intchoice=Keyboard.getInteger();switch(choice){//添加
5、学生case1:System.out.print("请输入学生信息");System.out.print("学号:");id=Keyboard.getString();System.out.print("姓名:");name=Keyboard.getString();System.out.print("数学:");math=Keyboard.getInteger();System.out.print("英语:");english=Keyboard.getInteger();System.out.print("JAVA:");java=Keyboard.getInt
6、eger();System.out.print("计算机:");computer=Keyboard.getInteger();stmt.executeUpdate("insertintolxh1values('"+id+"','"+name+"','"+math+"','"+english+"','"+java+"','"+computer+"')");System.out.println("添加完成。");break;//更改成绩case2:System.out.println("请输入要改的学生学号:");cid=Keyboard.getString();Sy
7、stem.out.println("数学:");math=Keyboard.getInteger();System.out.println("英语:");english=Keyboard.getInteger();System.out.println("JAVA:");java=Keyboard.getInteger();System.out.println("计算机:");computer=Keyboard.getInteger();stmt.executeUpdate("updatelxh1setmath='"+math+"',english='
此文档下载收益归作者所有