其实也就是数据库的增删改查
创新互联公司是一家专注于网站设计制作、成都网站建设与策划设计,万荣网站建设哪家好?创新互联公司做网站,专注于网站建设十余年,网设计领域的专业建站公司;建站业务涵盖:万荣等地区。万荣做网站价格咨询:18980820575
首先建两张表 一个是用户表 一个是学生表
根据表的字段在entity包下建两个实体类 两张表对应两个实体类
如果使用mybatis的话可以在dao包下写接口
增 改 传实体类对象 删 和 按ID查询 传int 查全部不用传参数 条件查询最好传Map
然后在service包下定义所有需要用到的接口 在建个子包里面去实现接口 在controllor层就用接口new实现类
上面的代码会有冗余的部分 可以把那部分封装成一个utils
不同的view层用不同的controllor 至此Model层就写完了
如果view层是jsp的话 controllor可以用struts2 jsp请求到struts2的action action根据不同的请求调用不同的service 再由service调用dao操作数据库;
这就是MVC
能输出常用的各种报表。 9) 具有数据备份和数据恢复功能。 2、实验要求: 学生学籍管理系统(VB+ACCESS)+代码 学籍管理工作在正常的情况下需对大量
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class TestString {
public static void main(String[] args) throws IOException {
boolean flag = false;
do {
System.out.println();
System.out.println("Do you want to continue?(Y/N)");
Scanner scan = new Scanner(System.in);
String banlance = scan.next();
if (banlance.equals("Y")) {
flag = true;
} else if(banlance.equals("N")) {
System.out.println("End!");
break;
} else {
System.out.println("Error Input!");
}
System.out.print("Please input the String: ");
BufferedReader br = new BufferedReader(new InputStreamReader(
System.in));
String str = br.readLine();
StringBuffer strBuffer = new StringBuffer(str);
for(int i=0; istrBuffer.length(); i++) {//将元音字母先删掉
char c = strBuffer.charAt(i);
if ((c == 'a') || (c == 'e') || (c == 'i') || (c == 'o') || (c == 'u')) {
strBuffer = strBuffer.deleteCharAt(i);
--i;
}
}
for(int i=0,j=i+1; jstrBuffer.length(); i++,j++) {//处理重复辅音字母
char c1 = strBuffer.charAt(i), c2 = strBuffer.charAt(j);
if(c1 == c2) {
strBuffer = strBuffer.deleteCharAt(i);
--i;
--j;
}
}
System.out.println(strBuffer);
} while (flag = true);
}
}
测试与结果:
Based on your subject 求JAVA学生学籍管理系统源代码,
带着你的问题和Email来找我,
有别的要求也可以联系我们,
有时间可以帮你,
百度_Hi给我吧,
此回复对于所有需求和和来访者有效,
ES:\\58196DEDCB084FACA5B83FA0D018295E
public class MainTest {
private static Scanner sc = new Scanner(System.in);
private static Scanner scn = new Scanner(System.in);
public static void main(String[] args) {
show();
}
private static void show() {
String s0 = "\n\t-----------------学生管理系统----------------\n", s1, s2, s3, s4, s5, s6;
s1 = "\t1.添加学生";
s2 = "\n\t2.修改学生";
s3 = "\n\t3.删除学生";
s4 = "\n\t4.查询学生";
s5 = "\n\t5.打印所有学生";
s6 = "\n\t6.退出系统";
sop(s0 + s1 + s2 + s3 + s4 + s5 + s6);
init();
}
private static void init() {
// 管理类!
StuManager sm = new StuManager();
while (true) {
int key = scn.nextInt();
switch (key) {
case 1:
method(1,sm);
break;
case 2:
method(2,sm);
break;
case 3:
method(3,sm);
break;
case 4:
method(4,sm);
break;
case 5:
method(5,sm);
break;
default:
System.exit(0);;
break;
}
}
}
private static void method(int n,StuManager sm) {
if (n == 1) {
sop("添加:学号,Nmae,Phone");
sm.addStudent(new Student(sc.nextLine(),sc.nextLine(),scn.nextLong()));
} else if (n == 2) {
sop("修改:");
sm.updateStudent(sc.nextLine());
} else if (n == 3) {
sop("删除:");
sm.deleteStudent(sc.nextLine());
} else if (n == 4) {
sop("查询:");
sop(sm.getStudent(sc.nextLine()));
} else{
sm.printAllStudent();
}
}
private static void sop(Object obj) {
System.out.println(obj);
}
}
class Student {
private String Number;
private String name;
private long phone;
public Student(String number, String name, long phone) {
super();
Number = number;
this.name = name;
this.phone = phone;
}
public String getNumber() {
return Number;
}
public void setNumber(String number) {
Number = number;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getPhone() {
return phone;
}
public void setPhone(long phone) {
this.phone = phone;
}
public String toString() {
return "学号:" + Number + "\tNmae:" + name + "\tPhone:" + phone;
}
}
class StuManager {
private Student[] Students;
private int porin = 0;
private Scanner sc = new Scanner(System.in);
private Scanner scn = new Scanner(System.in);
StuManager() {
Students = new Student[20];
}
public void addStudent(Student student) {
if (porin Students.length - 1)
return;
Students[porin] = student;
porin++;
}
public void deleteStudent(String number) {
for (int i = 0; i Students.length; i++) {
if (Students[i].getNumber().equals(number)) {
Students[i] = null;
return;
}
}
sop("不存在!");
}
public void updateStudent(String number) {
for (int i = 0; i Students.length; i++) {
if (Students[i].getNumber().equals(number)) {
sop("输入修改name:");
Students[i].setName(sc.nextLine());
;
try {
sop("输入Phone:");
Students[i].setPhone(scn.nextLong());
} catch (Exception e) {
sop("输入有误重新输入:");
updateStudent(number);
}
} else {
sop("不存在!");
return;
}
}
}
public Student getStudent(String stuNo) {
Student tem=null;
for (int i = 0; i Students.length; i++) {
if(Students[i]==null) {
return tem;
}
if (Students[i].getNumber().equals(stuNo)) {
tem=Students[i];
}
}
sop("查无此人!");
return tem;
}
public void printAllStudent() {
for (int i = 0; i Students.length; i++) {
sop(Students[i]);
}
}
private void sop(Object obj) {
System.out.println(obj);
}
}
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class $ {
public static void main(String... _) {
int len = 30;
// 1. 能输入10个学生信息,学生信息中包含学号,姓名,年龄,语文,数学,英语等内容;
Scanner in = new Scanner(System.in);
List data = new ArrayList();
for (int i = 0; i len; i++) {
Student bean = new Student();
System.out.print("输入第" + (i + 1) + "个人的工号:");
String no = in.next();
bean.setNo(no);
System.out.print("输入第" + (i + 1) + "个人的名称:");
String name = in.next();
bean.setName(name);
System.out.print("输入第" + (i + 1) + "个人的年纪:");
int age = in.nextInt();
bean.setAge(age);
System.out.print("输入第" + (i + 1) + "个人的数学成绩:");
double shuxue = in.nextDouble();
bean.setShuxue(shuxue);
System.out.print("输入第" + (i + 1) + "个人的语文成绩:");
double yuwen = in.nextDouble();
bean.setYuwen(yuwen);
data.add(bean);
}
while (true) {
System.out.println("1.统计总分;2.统计平均分;3.输出个人信息;4.查询;5.排序;0.退出;");
int idx = in.nextInt();
if (idx == 1) {
for (int i = 0; i data.size(); i++) {
Student bean = (Student) data.get(i);
System.out.println(bean.all());
}
}
if (idx == 2) {
for (int i = 0; i data.size(); i++) {
Student bean = (Student) data.get(i);
System.out.println(bean.avg());
}
}
if (idx == 3) {
System.out.println(data);
}
if (idx == 4) {
String str = "aaa";
for (int i = 0; i data.size(); i++) {
Student bean = (Student) data.get(i);
if (bean.getNo().equals(str) || bean.getName().equals(str)) {
System.out.println(bean);
break;
}
}
}
if (idx == 5) {
// 按学号排序
Collections.sort(data, new ComparatorStudent() {
public int compare(Student o1, Student o2) {
return o1.getNo().compareTo(o2.getNo());
}
});
System.out.println(data);
}
if (idx == 0) {
System.exit(0);
}
}
}
}
篇幅受限,你追问,我在给你贴