1 package System; 2 import java.util.Scanner; 3 public class PaperManagement { 4 public static void main(String[] args) { 5 Scanner scanner = new Scanner(System.in); 6 ScoreInformation[] students = new ScoreInformation[5]; 7 students[0] = new ScoreInformation("20230001","yi","xin2205-1","","",0,false); 8 while (true) { 9 System.out.println("***********************************************************"); 10 System.out.println(" 石家庄铁道大学软件工程系毕业设计论文管理系统2021版"); 11 System.out.println("***********************************************************"); 12 System.out.println(" 1、毕业设计论文提交"); 13 System.out.println(" 2、毕业设计论文查重"); 14 System.out.println(" 3、毕业设计论文审查"); 15 System.out.println(" 4、退出论文管理系统"); 16 System.out.print("请输入数字选项:"); 17 18 int choice = scanner.nextInt(); 19 scanner.nextLine(); 20 21 switch (choice) { 22 case 1: 23 paperSubmission(students, scanner); 24 break; 25 case 2: 26 checkPlagiarism(students, scanner); 27 break; 28 case 3: 29 reviewPaper(students, scanner); 30 break; 31 case 4: 32 System.out.println("退出论文管理系统。"); 33 scanner.close(); 34 return; 35 default: 36 System.out.println("错误:该选项不存在,请重新输入。"); 37 break; 38 } 39 } 40 } 41 ///////////////////////////////////////////////////////////////////////////////////////////////////// 42 public static void paperSubmission(ScoreInformation[] students, Scanner scanner) { 43 System.out.println("***********************************************************"); 44 System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版"); 45 System.out.println("毕业设计论文提交"); 46 System.out.println("***********************************************************"); 47 48 System.out.print("请输入学生学号:"); 49 String stunumber = scanner.nextLine(); 50 51 ScoreInformation student = findStudent(students, stunumber); 52 53 if (student == null) { 54 System.out.println("错误:该学号不存在。"); 55 return; 56 } 57 58 System.out.println("学生学号:" + student.getStunumber()); 59 System.out.println("学生姓名:" + student.getName()); 60 System.out.println("所在班级:" + student.getStuclass()); 61 62 System.out.print("请输入毕业设计论文题目:"); 63 String papertitle = scanner.nextLine(); 64 65 if (papertitle.length() > 10) { 66 System.out.println("错误:毕业设计论文题目超过10个字符。"); 67 return; 68 } 69 70 System.out.println("请输入毕业设计论文正文:"); 71 StringBuilder paperbodyBuilder = new StringBuilder(); 72 73 while (true) { 74 String line = scanner.nextLine(); 75 76 if (line.equals("END")) { 77 break; 78 } 79 80 paperbodyBuilder.append(line); 81 paperbodyBuilder.append("\n"); 82 } 83 84 String paperbody = paperbodyBuilder.toString(); 85 86 if (paperbody.length() > 200) { 87 System.out.println("错误:毕业设计论文正文超过200个字符。"); 88 return; 89 } 90 91 student.setPapertitle(papertitle); 92 student.setPaperbody(paperbody); 93 94 System.out.println("毕业设计论文题目:" + student.getPapertitle()); 95 System.out.println("毕业设计论文正文:" + student.getPaperbody()); 96 97 System.out.print("该学生成绩已录入完毕,是否提交(Y/N):"); 98 String submitChoice = scanner.nextLine(); 99 100 if (submitChoice.equalsIgnoreCase("Y")) { 101 102 System.out.println("论文题目和正文内容已保存。"); 103 } else { 104 System.out.println("已取消提交。"); 105 } 106 } 107 108 public static ScoreInformation findStudent(ScoreInformation[] students, String stunumber) { 109 for (ScoreInformation student : students) { 110 if (student != null && student.getStunumber().equals(stunumber)) { 111 return student; 112 } 113 } 114 return null; 115 } 116 /////////////////////////////////////////////////////////////////////////////////////// 117 118 public static void checkPlagiarism(ScoreInformation[] students, Scanner scanner) { 119 System.out.println("***********************************************************"); 120 System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版"); 121 System.out.println("毕业设计论文查重"); 122 System.out.println("***********************************************************"); 123 124 System.out.print("请输入学生学号:"); 125 String stunumber = scanner.nextLine(); 126 127 ScoreInformation student = findStudent(students, stunumber); 128 129 if (student == null) { 130 System.out.println("错误:该学号不存在。"); 131 return; 132 } 133 134 System.out.println("学生学号:" + student.getStunumber()); 135 System.out.println("学生姓名:" + student.getName()); 136 System.out.println("所在班级:" + student.getStuclass()); 137 System.out.println("毕业设计论文题目:" + student.getPapertitle()); 138 System.out.println("毕业设计论文正文:" + student.getPaperbody()); 139 140 System.out.print("请输入毕业设计论文查重率:"); 141 double plagiarismRate = scanner.nextDouble(); 142 scanner.nextLine(); // Consume the newline character 143 144 if (plagiarismRate < 0 || plagiarismRate > 100) { 145 System.out.println("错误:查重率输入不合法,请重新输入。"); 146 return; 147 } 148 149 System.out.println("毕业设计论文查重率:" + plagiarismRate); 150 151 System.out.print("是否提交?(Y/N):"); 152 String submitChoice = scanner.nextLine(); 153 154 if (submitChoice.equalsIgnoreCase("Y")) { 155 156 student.setPaperpass(plagiarismRate); 157 System.out.println("查重率已保存。"); 158 } else { 159 System.out.println("已取消提交。"); 160 } 161 } 162 /////////////////////////////////////////////////////////////////////////////////////////// 163 public static void reviewPaper(ScoreInformation[] students, Scanner scanner) { 164 System.out.println("***********************************************************"); 165 System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版"); 166 System.out.println("毕业设计论文审查"); 167 System.out.println("***********************************************************"); 168 169 System.out.print("请输入学生学号:"); 170 String stunumber = scanner.nextLine(); 171 172 ScoreInformation student = findStudent(students, stunumber); 173 174 if (student == null) { 175 System.out.println("错误:该学号不存在。"); 176 return; 177 } 178 179 System.out.println("学生学号:" + student.getStunumber()); 180 System.out.println("学生姓名:" + student.getName()); 181 System.out.println("所在班级:" + student.getStuclass()); 182 System.out.println("毕业设计论文题目:" + student.getPapertitle()); 183 System.out.println("毕业设计论文正文:" + student.getPaperbody()); 184 System.out.println("毕业设计论文查重率:" + student.getPaperpass()); 185 186 if (student.getPaperpass() >= 0.2) { 187 System.out.println("该学生毕业设计论文重复率超过20%,不允许进行论文审查。"); 188 return; 189 } 190 191 System.out.print("是否同意该学生参加毕业设计答辩?(Y/N):"); 192 String reviewChoice = scanner.nextLine(); 193 194 if (reviewChoice.equalsIgnoreCase("Y")) { 195 // Save the review result 196 student.setPaperreview(true); 197 System.out.println("审查结果已保存。"); 198 } else { 199 System.out.println("已取消审查。"); 200 } 201 } 202 }
标签:scanner,Java,毕业设计,16,System,student,println,2023.8,out From: https://www.cnblogs.com/muzhaodi/p/17636010.html