如何用java制作学生管理系统
5个回答
展开全部
是要小型的还是大型的 小型的 需要数据库吗?下面这是个 控制台输出的
import java.util.List;
import java.util.Scanner;
import cn.com.shxt.DBUtils.JdbcTool;
public class StudentManager {
/*
1.学生信息管理系统,界面如下
1--学生信息添加
2--全部学生信息查询
3--查询录取学生的信息
4--按学号查询录取学生的信息
5--按姓名查询录取学生的信息
6--退出
*/
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
JdbcTool jt = new JdbcTool();
List<List<String>> tableList ;
int flag;
String no;
String name;
String main;
String politics;
String English;
String Math;
String Major;
String Total;
String sql;
boolean panduan= true;
while(panduan) {
System.out.println();
System.out.println("===========欢迎进入研究生录取系统================");
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("请输入序号,选择功能");
flag = scan.nextInt();
switch (flag) {
case 1:
System.out.println("请输入学生的 学号、姓名、报考专业、政治、英语、高数、专业课分数");
no = scan.next();
name = scan.next();
main= scan.next();
politics = scan.next();
English = scan.next();
Math = scan.next();
Major = scan.next();
int total=0;
total=Integer.parseInt(politics)+Integer.parseInt(English)+Integer.parseInt(Math)+Integer.parseInt(Major);
sql = "insert into stumanager (s_no, s_name,s_main, s_politics,s_English,s_Math,s_Major,s_Total) values('" + no + "','" + name + "','" + main + "'," + politics + ",'" + English + "','" + Math + "','" + Major + "','" + total + "')";
jt.update(sql);
System.out.println("添加成功");
break;
case 2:
sql = "select * from stumanager order by s_total desc ";
tableList = jt.query(sql);
if(tableList!=null && tableList.size() > 0){
tableList = jt.query(sql);
for(List<String> rowList : tableList) {
System.out.println("id\t学号\t\t姓名\t专业\t政治\t英语\t高数\t专业\t总分\t");
System.out.println(rowList.get(0) + "\t" + rowList.get(1) + "\t" + rowList.get(2) + "\t" + rowList.get(3) + "\t" + rowList.get(4)+ "\t" + rowList.get(5)+ "\t" + rowList.get(6)+ "\t" + rowList.get(7)+ "\t"+ rowList.get(8));
}
}else {
System.out.println("没有学生信息,请添加~~");
break;
}
break;
case 3:
System.out.println("请输入报考专业以及政治、英语、高数、专业课、总分的分数");
main= scan.next();
politics = scan.next();
English = scan.next();
Math = scan.next();
Major = scan.next();
Total = scan.next();
sql = "select * from stumanager where s_main ='" + main + "' and s_politics >= " + politics + " and s_English>= " + English + " and s_Math>= " + Math + " and s_Major>= " + Major + " and s_Total>= " + Total + " ";
tableList = jt.query(sql);
if(tableList.size() != 0){
tableList = jt.query(sql);
for(List<String> rowList : tableList) {
System.out.println("id\t学号\t\t姓名\t专业\t政治\t英语\t高数\t专业\t总分\t");
System.out.println(rowList.get(0) + "\t" + rowList.get(1) + "\t" + rowList.get(2) + "\t" + rowList.get(3) + "\t" + rowList.get(4)+ "\t" + rowList.get(5)+ "\t" + rowList.get(6)+ "\t" + rowList.get(7)+ "\t" + rowList.get(8));
System.out.println("恭喜你,你被录取了");
}
}else {
System.out.println("抱歉,你没有被录取");
break;
}
break;
case 4:
System.out.println("请输入要查询的学生的学号以及政治、英语、高数、专业课、总分的录取分数");
no = scan.next();
politics = scan.next();
English = scan.next();
Math = scan.next();
Major = scan.next();
Total = scan.next();
System.out.println("此学生的信息:");
sql = "select * from stumanager where s_politics >= " + politics + " and s_English>= " + English + " and s_Math>= " + Math + " and s_Major>= " + Major + " and s_Total>= " + Total + " and s_no= " + no + " " ;
tableList = jt.query(sql);
if(tableList!=null && tableList.size() > 0){
tableList = jt.query(sql);
for(List<String> rowList : tableList) {
System.out.println("id\t学号\t\t姓名\t专业\t政治\t英语\t高数\t专业\t总分\t");
System.out.println(rowList.get(0) + "\t" + rowList.get(1) + "\t" + rowList.get(2) + "\t" + rowList.get(3) + "\t" + rowList.get(4)+ "\t" + rowList.get(5)+ "\t" + rowList.get(6)+ "\t" + rowList.get(7)+"\t" + rowList.get(8));
System.out.println("恭喜你,你被录取了");
}
}else {
System.out.println("抱歉,你没有被录取");
break;
}
break;
case 5:
System.out.println("请输入要查询的学生姓名(单个文字也可)以及政治、英语、高数、专业课、总分的录取分数");
name = scan.next();
politics = scan.next();
English = scan.next();
Math = scan.next();
Major = scan.next();
Total = scan.next();
sql = "select * from stumanager where s_politics >= " + politics + " and s_English>= " + English + " and s_Math>= " + Math + " and s_Major>= " + Major + " and s_Total>= " + Total + " and s_name like '%" + name + "%' " ;
tableList = jt.query(sql);
if(tableList!=null && tableList.size() > 0){
tableList = jt.query(sql);
for(List<String> rowList : tableList) {
System.out.println("id\t学号\t\t姓名\t专业\t政治\t英语\t高数\t专业\t总分\t");
System.out.println(rowList.get(0) + "\t" + rowList.get(1) + "\t" + rowList.get(2) + "\t" + rowList.get(3) + "\t" + rowList.get(4)+ "\t" + rowList.get(5)+ "\t" + rowList.get(6)+ "\t" + rowList.get(7)+ "\t" + rowList.get(8));
System.out.println("恭喜你,你被录取了");
}
}else {
System.out.println("抱歉,你没有被录取");
break;
}
break;
case 0:
panduan = false;
break;
}
}
}
}
展开全部
cs的还是bs的
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个简单。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
我可以做一个
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以私信我或者125 8 1 9 398
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询