所有回答
这个一般的系统都可以做到的呀 一般的CMS都可以做到的 很见到的
这是要定向开发吗?如果需要的话,可以与我联系 QQ3615101
import java.util.Scanner;
|
public class HotelManager {
|
private static String[][] rooms;// 表示房间
|
public static void main(String[] args) {
|
rooms = new String[10][12];
|
for (int i = 0; i < rooms.length; i++) {
|
for (int j = 0; j < rooms[0].length; j++) {
|
System.out.println("欢迎光临【程序猿】旅店,请输入命令:");
|
Scanner sca = new Scanner(System.in);
|
if ("search".equalsIgnoreCase(comm)) {
|
} else if ("in".equalsIgnoreCase(comm)) {
|
int roomNo = sca.nextInt();
|
String name = sca.next();
|
} else if ("out".equalsIgnoreCase(comm)) {
|
int roomNo = sca.nextInt();
|
} else if ("exit".equalsIgnoreCase(comm)) {
|
System.out.println("程序退出...");
|
} else if ("help".equalsIgnoreCase(comm)) {
|
.println(" in命令格式:in 房号 姓名\n out命令格式:out 房号 姓名\n search命令:查看所有房间状态 \n exit命令:退出");
|
System.out.println("命令输入错误,请重新输入:");
|
private static void out(int roomNo) {
|
if ("EMPTY".equals(rooms[(roomNo / 100) - 1][(roomNo % 100) - 1])) {
|
System.out.println("该房间没有客人入住,退房失败!");
|
rooms[(roomNo / 100) - 1][(roomNo % 100) - 1] = "EMPTY";
|
System.out.println(roomNo + "退房成功!");
|
private static void in(int roomNo, String name) {
|
if (!"EMPTY".equals(rooms[(roomNo / 100) - 1][(roomNo % 100) - 1])) {
|
System.out.println("该房间已经有客人入住!");
|
rooms[(roomNo / 100) - 1][(roomNo % 100) - 1] = name;
|
System.out.println(name + "成功入住" + roomNo + "房间!");
|
private static void search() {
|
for (int i = 0; i < rooms.length; i++) {
|
for (int j = 0; j < rooms[0].length; j++) {
|
System.out.print(i + 1 + "0" + (j + 1) + " ");
|
System.out.print(i + 1 + "" + (j + 1) + " ");
|
for (int j = 0; j < rooms[0].length; j++) {
|
System.out.print(rooms[i][j] + " ");
|
packagecom.iflytek.studentmanagesystem.view;
|
importjava.util.Comparator;
|
importcom.iflytek.studentmanagesystem.pojo.Student;
|
importcom.iflytek.studentmanagesystem.service.StudentService;
|
importcom.iflytek.studentmanagesystem.service.impl.StudentServiceImpl;
|
importcom.iflytek.studentmanagesystem.util.DateUtil;
|
publicstaticvoidmain(String[] args) {
|
System.out.println("#######欢迎使用xxxx学生管理系统#######");
|
System.out.println("1.增加学生信息\n2.删除学生信息\n3.修改学生信息\n4.查询学生信息\n0.退出系统\n请选择:");
|
Scanner sc =newScanner(System.in);
|
intselect = sc.nextInt();
|
System.out.println("错误的功能代码!");
|
privatestaticvoiddoAddStudent() {
|
// TODO Auto-generated method stub
|
StudentService service =newStudentServiceImpl();
|
Scanner sc =newScanner(System.in);
|
System.out.println("输入要新增的学生的学号:");
|
intnumber = sc.nextInt();
|
if(service.queryByNumber(number) !=null) {
|
System.out.println("该学号对应的学生信息已经存在!");
|
sc.nextLine();// 消除前面输入整数留下的回车符
|
System.out.println("输入要新增的学生姓名:");
|
String name = sc.nextLine();
|
System.out.println("请输入要新增的学生性别:");
|
String gender = sc.nextLine();
|
System.out.println("请输入要新增的学生出生日期(如1990-1-1):");
|
String birthday = sc.nextLine();
|
System.out.println("请输入要新增的学生入学日期(如2019-9-1):");
|
String entranceday = sc.nextLine();
|
Student stu =newStudent();
|
stu.setBirthday(DateUtil.str2date(birthday));
|
stu.setEntranceday(DateUtil.str2date(entranceday));
|
if(1== service.add(stu)) {
|
System.out.println("学生信息新增完成!");
|
System.out.println("学生信息增加失败!");
|
privatestaticvoiddoDeleteStudent() {
|
StudentService service =newStudentServiceImpl();
|
Scanner sc =newScanner(System.in);
|
System.out.println("输入要删除的学生的学号:");
|
intnumber = sc.nextInt();
|
if(0== service.delete(number)) {
|
System.out.println("学生信息不存在,删除失败!");
|
System.out.println("学生信息删除完成!");
|
privatestaticvoiddoModifyStudent() {
|
StudentService service =newStudentServiceImpl();
|
Scanner sc =newScanner(System.in);
|
System.out.println("输入要修改的学生的学号:");
|
intnumber = sc.nextInt();
|
if(service.queryByNumber(number) ==null) {
|
System.out.println("该学号对应的学生信息不存在,无法修改!");
|
System.out.println("输入要修改的学生新的姓名:");
|
String name = sc.nextLine();
|
System.out.println("请输入要修改的学生新的性别:");
|
String gender = sc.nextLine();
|
System.out.println("请输入要修改的学生新的出生日期(如1990-1-1):");
|
String birthday = sc.nextLine();
|
System.out.println("请输入要修改的学生新的入学日期(如2019-9-1):");
|
String entranceday = sc.nextLine();
|
Student stu =newStudent();
|
stu.setBirthday(DateUtil.str2date(birthday));
|
stu.setEntranceday(DateUtil.str2date(entranceday));
|
if(1== service.modify(stu)) {
|
System.out.println("学生信息修改完成!");
|
System.out.println("学生信息修改失败!");
|
privatestaticvoiddoQeuryStudent() {
|
StudentService service =newStudentServiceImpl();
|
System.out.println("1.按学号查询\n2.按姓名查询\n3.查看所有\n4.按年龄降序查看所有\n0.返回\n请选择:");
|
Scanner sc =newScanner(System.in);
|
intselect = sc.nextInt();
|
System.out.println("输入要查询的学生的学号:");
|
intnumber = sc.nextInt();
|
Student stu = service.queryByNumber(number);
|
System.out.println("未查询到相关信息");
|
System.out.println("查询到学生的信息:\n"+ stu);
|
System.out.println("输入要查询的学生的姓名:");
|
List<Student> stus = service.queryByName(name);
|
System.out.println("未查询到相关信息");
|
System.out.println("查询到学生的信息:");
|
for(inti =0; i < stus.size(); i++) {
|
System.out.println(stus.get(i));
|
System.out.println("所有学生的信息:");
|
List<Student> stus = service.queryAll();
|
for(inti =0; i < stus.size(); i++) {
|
System.out.println(stus.get(i));
|
System.out.println("按年龄降序排列学生的信息:");
|
List<Student> stus = service.queryAll();
|
stus.sort(newComparator<Student>() {
|
publicintcompare(Student o1, Student o2) {
|
return(int) (o2.getBirthday().getTime() - o1.getBirthday().getTime());
|
for(inti =0; i < stus.size(); i++) {
|
System.out.println(stus.get(i));
|
System.out.println("错误的功能代码!");
|
这个一般的系统都可以做到的呀 一般的CMS都可以做到的 很见到的