话不多说,先上代码;怎么说,照猫画虎,不得其精髓;既不得其精,自然需要提炼重点,由点到面系统性的学习。
这次的考试仅仅是一个开始,通过不断地参与考试,不断地练习题目,不断地发现自己的漏洞来完善,查漏补缺,尽快追上同学们的水平。
至于代码问题
package myjava01;
public class RoomInformation {
private String roomno,stunno1,stunno2,stunno3,stunno4;
private int hygienescore;
public String getRoomno()
{
return roomno;
}
public void setRoomno(String roomno)
{
this.roomno = roomno;
}
public String getStunno1()
{
return stunno1;
}
public void setStunno1(String stunno1)
{
this.stunno1 = stunno1;
}
public String getStunno2()
{
return stunno2;
}
public void setStunno2(String stunno2)
{
this.stunno2 = stunno2;
}
public String getStunno3()
{
return stunno3;
}
public void setStunno3(String stunno3)
{
this.stunno3 = stunno3;
}
public String getstunno4()
{
return stunno4;
}
public void setStunno4(String stunno4)
{
this.stunno4 = stunno4;
}
public int gethygienescore()
{
return hygienescore;
}
public void sethygienescore(int hygienescore)
{
this.hygienescore = hygienescore;
}
package myjava01;
import java.util.ArrayList;
import java.util.Scanner;
public class RoomManagement {
static Scanner sc=new Scanner(System.in);
static ArrayList<RoomInformation> room=new ArrayList<RoomInformation>();
public static void main(String[] args) {
room.add(new RoomInformation("9#101","20214000","20214001","20214002","20214003",0));
room.add(new RoomInformation("9#102","20214004","20214005","20214006","20214007",0));
room.add(new RoomInformation("9#103","20214008","20214009","20214010","",0));
room.add(new RoomInformation("9#104","20214011","20214012","20214013","20214014",0));
room.add(new RoomInformation("9#105","20214122","20214123","","",0));
room.add(new RoomInformation("9#106","20214124","","","",0));
room.add(new RoomInformation("9#107","","","","",0));
room.add(new RoomInformation("9#108","","","","",0));
room.add(new RoomInformation("9#109","","","","",0));
room.add(new RoomInformation("9#110","","","","",0));
while(true) {
preShow();
String s=sc.nextLine();
switch(s) {
case"1":while(handIn()==false);break;
case"2":while(ckc()==false);break;
case"3":while(ck()==false);break;
case"4":while();
case"5":while();
default:System.out.println("该选项不存在,请重新输入!");
}
}
}
static void showTitle() {
System.out.println("***********************************************************");
System.out.println("\t\t石家庄铁道大学公寓管理系统v2022");
}
static int getIdx(String S) {
while(true) {
showTitle();
System.out.println("\t\t\t宿舍号查询"+S);
System.out.println("***********************************************************");
System.out.println("\t\t\t请输入学生学号:XXXXXXXX");
System.out.println("**********************************************************");
String s=sc.nextLine();
for(int i=0;i<room.size();i++) {
if(room.get(i).getStunno1().equals(s)) {
return i;
}
}
System.out.println("该学号不存在,请重新输入");
}
}
public static void preShow() {
showTitle();
System.out.println("\t\t\t学生公寓管理系统 v2022");
System.out.println("***********************************************************");
System.out.println("\t\t\t1、宿舍查询");
System.out.println("\t\t\t2、安排新宿舍");
System.out.println("\t\t\t3、调整宿舍");
System.out.println("\t\t\t4、卫生检查情况查询");
System.out.println("***********************************************************");
}
public static boolean handIn() {
int idx=getIdx("提交");
RoomInformation a=new RoomInformation("","","","","",0);
while(true) {
showTitle();
System.out.println("\t\t\t毕业设计论文提交");
System.out.println("***********************************************************");
System.out.println("\t\t\t学生学号:"+room.get(idx).getStunno1());
System.out.println("\t\t\t学生姓名:"+room.get(idx).getStunno2());
System.out.println("\t\t\t所在班级:"+room.get(idx).getStunno3());
System.out.println("\t\t\t请输入毕业设计论文题目:XXXXXX XXXX");
System.out.println("**********************************************************");
String s=sc.nextLine();
if(s.length()<=10) {
a.setPapertitle(s);
break;
}
else System.out.println("毕业设计论文题目超过10个字符,请重新输入!");
}
StringBuilder sb=new StringBuilder();
while(true) {
showTitle();
System.out.println("\t\t\t毕业设计论文提交");
System.out.println("***********************************************************");
System.out.println("\t\t\t学生学号:"+room.get(idx).getStunno1());
System.out.println("\t\t\t学生姓名:"+room.get(idx).getStunno2());
System.out.println("\t\t\t所在班级:"+room.get(idx).getStunno3());
System.out.println("\t\t毕业设计论文题目:"+a.getPapertitle());
System.out.println("\t\t\t请输入毕业设计论文正文:XXXXXXXXXX");
System.out.println("**********************************************************");
int k=0;
while(k<=200) {
String s=sc.next();
int len=s.length();
sb.append(s+" ");
k+=len;
if(len>=3&&s.substring(len-3).equals("END")) {
break;
}
}
if(k<=200) {
a.setPaperbody(sb.toString());
String sos=sc.nextLine();
break;
}
else System.out.println("毕业设计论文正文超过200个字符,请重新输入!");
}
while(true) {
showTitle();
System.out.println("\t\t\t毕业设计论文提交");
System.out.println("***********************************************************");
System.out.println("\t\t\t学生学号:"+room.get(idx).getStunno1());
System.out.println("\t\t\t学生姓名:"+room.get(idx).getStunno2());
System.out.println("\t\t\t所在班级:"+room.get(idx).getStunno3());
System.out.println("\t\t毕业设计论文题目:"+a.getPapertitle());
System.out.println("\t\t\t毕业设计论文正文:"+a.getPaperbody());
System.out.println("\t\t该学生成绩已录入完毕,是否提交(Y/N)");
System.out.println("**********************************************************");
String s=sc.nextLine();
if(s.equals("Y")) {
a.setStunno1(room.get(idx).getStunno1());
a.setStunno2(room.get(idx).getStunno2());
a.setStunno3(room.get(idx).getStunno3());
room.set(idx,a);
return true;
}
else return false;
}
}
public static boolean ckc() {
int idx=getIdx("查重");
while(true) {
showTitle();
System.out.println("\t\t\t毕业设计论文查重");
System.out.println("***********************************************************");
System.out.println("\t\t\t学生学号:"+room.get(idx).getStunno1());
System.out.println("\t\t\t学生姓名:"+room.get(idx).getStunno2());
System.out.println("\t\t\t所在班级:"+room.get(idx).getStunno3());
System.out.println("\t\t\t毕业设计论文题目:"+room.get(idx).getPapertitle());
System.out.println("\t\t\t毕业设计论文正文:"+room.get(idx).getPaperbody());
System.out.println("\t\t\t请输入毕业设计论文查重率:XXXXXXXXXX");
System.out.println("**********************************************************");
double x=sc.nextDouble();
sc.nextLine();
if(x>=0&&x<=1) {
list.get(idx).setPaperpass(x);
break;
}
else System.out.println("查重率输入不符合要求,请重新输入!");
}
while(true) {
showTitle();
System.out.println("\t\t\t毕业设计论文查重");
System.out.println("***********************************************************");
System.out.println("\t\t\t学生学号:"+room.get(idx).getStunno1());
System.out.println("\t\t\t学生姓名:"+room.get(idx).getName());
System.out.println("\t\t\t所在班级:"+room.get(idx).getStuclass());
System.out.println("\t\t\t毕业设计论文题目:"+() list.get(idx)).getPapertitle());
System.out.println("\t\t\t毕业设计论文正文:"+list.get(idx).getPaperbody());
System.out.println("\t\t\t毕业设计论文查重率:"+list.get(idx).getClass());
System.out.println("\t\t\t\t(Y/N)");
System.out.println("**********************************************************");
String s=sc.nextLine();
if(s.equals("Y")) return true;
else return false;
}
}
public static boolean ck() {
int idx=getIdx("审查");
while(true) {
showTitle();
System.out.println("\t\t\t毕业设计论文审查");
System.out.println("***********************************************************");
System.out.println("\t\t\t学生学号:"+list.get(idx).getStunno1());
System.out.println("\t\t\t学生姓名:"+list.get(idx).getName());
System.out.println("\t\t\t所在班级:"+list.get(idx).getStuclass());
System.out.println("\t\t毕业设计论文题目:"+list.get(idx).getPapertitle());
System.out.println("\t\t\t毕业设计论文正文:"+list.get(idx).getPaperbody());
System.out.println("\t\t\t毕业设计论文查重率:"+list.get(idx).getClass());
System.out.println("**********************************************************");
if(list.get(idx).getClass()>=0.2) {
System.out.println("该学生毕业设计论文重复率超过20%,不允许进行论文审查");
return false;
}
else break;
}
while(true) {
showTitle();
System.out.println("\t\t\t毕业设计论文查重");
System.out.println("***********************************************************");
System.out.println("\t\t\t学生学号:"+room.get(idx).getStunno1());
System.out.println("\t\t\t学生姓名:"+room.get(idx).getStunno2());
System.out.println("\t\t\t所在班级:"+room.get(idx).getStuclass());
System.out.println("\t\t毕业设计论文题目:"+room.get(idx).getPapertitle());
System.out.println("\t\t\t毕业设计论文正文:"+room.get(idx).getPaperbody());
System.out.println("\t\t\t毕业设计论文查重率:"+room.get(idx).getClass());
System.out.println("\t\t是否同意该学生参加毕业设计答辩:(Y/N)");
System.out.println("**********************************************************");
String s=sc.nextLine();
if(s.equals("Y")) {
room.get(idx).setPaperreview(true);
return false;
}
else return true;
}
}
public static void myExit() {
showTitle();
System.out.println("\t\t\t制作人:庄忠旭");
System.out.println("**********************************************************");
System.exit(0);
}
}
等于是抄代码,外加同学部分解释,我大体理解这个题目的基本框架,但是自己是不会搭建框架结构。
问题显而易见,就是学的少,了解的少,以至于某些知识点都没有理解总结到位。
既然在学校里,交了学费,浪费是可耻的,总有一天我要自己做出来!
public RoomInformation(String roomno ,String stunno1,String stunno2,String stunno3,String stunno4,int hygienescore)
{
this.roomno = roomno;
this.stunno1 = stunno1;
this.stunno2 = stunno2;
this.stunno3 = stunno3;
this.stunno4 = stunno4;
this.hygienescore = hygienescore;
}
}
标签:总结,room,idx,get,System,9.2,println,考试,out From: https://www.cnblogs.com/XiMenXve/p/16653746.html