23201115-邓俊豪的第一次blog

PTA三次大作业

前言

关于难度和题目量

前三次大作业难度属于偏难水平,题目量也在可承受范围内

关于知识点

在这三次大作业中主要考查了对Java面向对象编程思想建立,还有类的定义——如何去设置一个类的属性和方法,还有类与类之间的关系,涉及的知识点有ArrayList的基本用法,还有HashMap的基本用法——通过索引快速找到Value,在数据处理方面使用了正则表达式来限制String,以此在这段时间内我去学习了正则表达式的基本用法,还有两个类——Pattern,Matcher,一个类用来决定匹配字符串的格式,一个类用来匹配字符串,

设计与分析

第一次大作业

题目

设计实现答题程序,模拟一个小型的测试,要求输入题目信息和答题信息,根据输入题目信息中的标准答案判断答题的结果。

输入格式:
程序输入信息分三部分:

1、题目数量

格式:整数数值,若超过1位最高位不能为0,

样例:34

2、题目内容

一行为一道题,可以输入多行数据。

格式:"#N:"+题号+" "+"#Q:"+题目内容+" "#A:"+标准答案

格式约束:题目的输入顺序与题号不相关,不一定按题号顺序从小到大输入。

样例:#N:1 #Q:1+1= #A:2

     #N:2 #Q:2+2= #A:4

3、答题信息

答题信息按行输入,每一行为一组答案,每组答案包含第2部分所有题目的解题答案,答案的顺序号与题目题号相对应。

格式:"#A:"+答案内容

格式约束:答案数量与第2部分题目的数量相同,答案之间以英文空格分隔。

样例:#A:2 #A:78

  2是题号为1的题目的答案
  78是题号为2的题目的答案

答题信息以一行"end"标记结束,"end"之后的信息忽略。

输出格式:
1、题目数量

格式:整数数值,若超过1位最高位不能为0,

样例:34

2、答题信息

一行为一道题的答题信息,根据题目的数量输出多行数据。

格式:题目内容+" ~"+答案

样例:1+1=~2

      2+2= ~4

3、判题信息

判题信息为一行数据,一条答题记录每个答案的判断结果,答案的先后顺序与题目题号相对应。

格式:判题结果+" "+判题结果

格式约束:

 1、判题结果输出只能是true或者false,
 2、判题信息的顺序与输入答题信息中的顺序相同

样例:true false true

我的代码

import java.util.Scanner;

class Question{
    private  String q;
    private String N;
    private String A;

    public Question(String a,String b,String c){
        q=b;
        N=a;
        A=c;
    }
    boolean isAnswer(String a){
        return a.equals(A);
    }

     String getN() {
        return N;
    }
     String getA() {
        return A;
    }
    String getq(){
        return q;
    }
}
class Paper{
    private int num=0;
    private  Question[]arr=new Question[100];
    ParseInput input=new ParseInput();
    void add(String str){
        arr[num]=input.questionMatching(str);
        num++;
    }
    Paper getpaper(){
        return this;
    }
    void sort(){
        for(int i=0;i< num;i++){
            for(int j=0;j< num-1-i;j++){
                if(Integer.parseInt(arr[j].getN())>Integer.parseInt(arr[j+1].getN())){
                    Question temp=arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=temp;
                }
            }
        }
    }
    Question[] getarr(){
        return arr;
    }
}
class AnswerPaper{
    private Paper paper=new Paper();
    private boolean[]is=new boolean[100];
    private String []arr=new String[100];
    private  int num=0;
    void Setpaper(Paper a){
        this.paper=a;
    }
    ParseInput input=new ParseInput();
    void add(String str){
        Question[]arr1= paper.getarr();
        arr[num]=input.answerMatching(str);
        is[num]=arr[num].equals(arr1[num].getA());
        num++;
    }
    void show(){
        Question[]arr1= paper.getarr();
        for(int i=0;i<num;i++){
            System.out.println(arr1[i].getq()+"~"+arr[i]);
        }
        for(int i=0;i<num;i++){
            System.out.print(is[i]);
            if(i!=num-1){
                System.out.print(" ");
            }
        }
    }
}
class ParseInput{
     Question questionMatching(String s_question){
        String regex="#N:|#Q:|#A:";
        String []arr=s_question.split(regex);
        return new Question(arr[1].trim(),arr[2].trim(),arr[3].trim());
    }
    String answerMatching(String s_answer){
         return s_answer.replaceAll("#A:","");
    }
}
class Main{
    public static void main(String[]args){
        Scanner scanner=new Scanner(System.in);
        int n=scanner.nextInt();
        scanner.nextLine();
        Paper paper=new Paper();
        for(int i=0;i<n;i++){
            paper.add(scanner.nextLine());
        }
        paper.sort();
        AnswerPaper answerPaper=new AnswerPaper();
        answerPaper.Setpaper(paper);
        for(int i=0;i<n;i++){
            String in=scanner.next();
            if(in.equals("end")){
                break;
            }
            answerPaper.add(in);
        }
        answerPaper.show();

    }
}

分析报告

image-20240419220837368

image-20240419220939717

在Pta第一次大作业中我写了5个类

分别是paper,AnswerPaper,Question,ParseInput,Main

其中ParseInput用来解析输入的数据,将输入的数据全部转换为对应的对象并存储起来,paper表示的是试卷类

Question表示的是题目类,AnswerPaper表示的是答卷类

第一次题目相对比较容易,输入格式比较固定

第二次大作业

题目

设计实现答题程序,模拟一个小型的测试,以下粗体字显示的是在答题判题程序-1基础上增补或者修改的内容。

要求输入题目信息、试卷信息和答题信息,根据输入题目信息中的标准答案判断答题的结果。

输入格式:

程序输入信息分三种,三种信息可能会打乱顺序混合输入:

1、题目信息

一行为一道题,可输入多行数据(多道题)。

格式:"#N:"+题目编号+" "+"#Q:"+题目内容+" "#A:"+标准答案

格式约束:

1、题目的输入顺序与题号不相关,不一定按题号顺序从小到大输入。
2、允许题目编号有缺失,例如:所有输入的题号为1、2、5,缺少其中的3号题。此种情况视为正常。

样例:#N:1 #Q:1+1= #A:2

     #N:2 #Q:2+2= #A:4

2、试卷信息

一行为一张试卷,可输入多行数据(多张卷)。

格式:"#T:"+试卷号+" "+题目编号+"-"+题目分值

 题目编号应与题目信息中的编号对应。

 一行信息中可有多项题目编号与分值。

样例:#T:1 3-5 4-8 5-2

3、答卷信息

答卷信息按行输入,每一行为一张答卷的答案,每组答案包含某个试卷信息中的题目的解题答案,答案的顺序与试卷信息中的题目顺序相对应。

格式:"#S:"+试卷号+" "+"#A:"+答案内容

格式约束:答案数量可以不等于试卷信息中题目的数量,没有答案的题目计0分,多余的答案直接忽略,答案之间以英文空格分隔。

样例:#S:1 #A:5 #A:22

   1是试卷号 

   5是1号试卷的顺序第1题的题目答案

   22是1号试卷的顺序第2题的题目答案

答题信息以一行"end"标记结束,"end"之后的信息忽略。

输出格式:

1、试卷总分警示

该部分仅当一张试卷的总分分值不等于100分时作提示之用,试卷依然属于正常试卷,可用于后面的答题。如果总分等于100分,该部分忽略,不输出。

格式:"alert: full score of test paper"+试卷号+" is not 100 points"

样例:alert: full score of test paper2 is not 100 points

2、答卷信息

一行为一道题的答题信息,根据试卷的题目的数量输出多行数据。

格式:题目内容+""+答案++""+判题结果(true/false)

约束:如果输入的答案信息少于试卷的题目数量,答案的题目要输"answer is null"

样例:3+2=5true

     4+6=~22~false.

  answer is null

3、判分信息

判分信息为一行数据,是一条答题记录所对应试卷的每道小题的计分以及总分,计分输出的先后顺序与题目题号相对应。

格式:题目得分+" "+....+题目得分+"~"+总分

格式约束:

1、没有输入答案的题目计0分

2、判题信息的顺序与输入答题信息中的顺序相同
样例:5 8 0~13

根据输入的答卷的数量以上2、3项答卷信息与判分信息将重复输出。

4、提示错误的试卷号

如果答案信息中试卷的编号找不到,则输出”the test paper number does not exist”,参见样例9。

设计建议:

参考答题判题程序-1,建议增加答题类,类的内容以及类之间的关联自行设计。

我的代码


import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Question implements Comparable<Question>{
    private  String q;
    private int  N;
    private String A;
    private  int score;

    @Override
    public int compareTo(Question o) {
        return this.N-o.getN();
    }

    public Question(int  a, String b, String c){
        q=b;
        N=a;
        A=c;
    }
    boolean isAnswer(String a){
        return a.equals(A);
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    int getN() {
        return N;
    }
     String getA() {
        return A;
    }
    String getq(){
        return q;
    }
}
class Paper implements Comparable<Paper>{

    private  int N;
    private  List<Question>arr;

    public int compareTo(Paper a){
        return this.N-a.getN();
    }
    public int getN() {
        return N;
    }
    public void setN(int n) {
        N = n;
    }
    public List<Question> getArr() {
        return arr;
    }
    public void setArr(List<Question> arr) {
        this.arr = arr;
    }
}
class AnswerPaper implements Comparable<AnswerPaper> {
    private int N;

    private List<Answer>anarr;
    public int getN() {
        return N;
    }

    public List<Answer> getAnarr() {
        return anarr;
    }

    public void setAnarr(List<Answer> anarr) {
        this.anarr = anarr;
    }

    public void setN(int n) {
        N = n;
    }
    @Override
    public int compareTo(AnswerPaper o) {
        return N-o.getN();
    }




}
class Answer implements Comparable<Answer>{
    private int N;
    private String str;

    public String getstr() {
        return str;
    }

    public void setstr(String arr) {
        this.str = arr;
    }

    public void setN(int n) {
        N = n;
    }
    int getN(){
        return N;
    }
    @Override
    public int compareTo(Answer o) {
        return N-o.getN();
    }

}
class ParseInput{
     Question questionMatching(String s_question){
        String regex="#N:|#Q:|#A:";
        String []arr=s_question.split(regex);
        return new Question(Integer.parseInt(arr[1].trim()),arr[2].trim(),arr[3].trim());
    }
    Paper paperMatching(String s, List<Question> questionList) {
        String str = s.replaceAll("#T:", "");
        str = str.replaceAll("-", " ");
        String[] arr = str.split(" ");
        Paper paper = new Paper();
        paper.setN(Integer.parseInt(arr[0]));
        List<Question> questionListForPaper = new ArrayList<>();

        for (int i = 1; i < arr.length; i += 2) {
            int questionN = Integer.parseInt(arr[i]);
            int score = Integer.parseInt(arr[i + 1]);

            for (Question originalQuestion : questionList) {
                if (originalQuestion.getN() == questionN) {
                    Question questionForPaper = new Question(originalQuestion.getN(), originalQuestion.getq(), originalQuestion.getA());
                    questionForPaper.setScore(score);
                    questionListForPaper.add(questionForPaper);
                    break;
                }
            }
        }

        paper.setArr(questionListForPaper);
        return paper;
    }

    AnswerPaper answerMatching(String s_answer,List<Paper>List){
          String s=s_answer.replaceAll("#A:|#S:","");
          String []strArr=s.split(" ");
          AnswerPaper a=new AnswerPaper();
          a.setN(Integer.parseInt(strArr[0]));
         List<Answer>answerList=new ArrayList<>();
         Paper paper = null;
         for(Paper aa:List){
             if(aa.getN()==a.getN()){
                 paper=aa;
             }
         }
         if(paper==null){
             return null;
         }
             int i=1;
             for(Question question:paper.getArr()){
                 if(i<strArr.length){
                     Answer answer=new Answer();
                     answer.setN(question.getN());
                     answer.setstr(strArr[i]);
                     answerList.add(answer);
                 }
                else{
                    break;
                 }
                i++;
             }
         a.setAnarr(answerList);
         return a;
    }
}
class Main{
    public static void main(String[]args){
        Scanner scanner=new Scanner(System.in);
        String str;
        List <Question> questionList=new ArrayList<>();
        List<Paper>paperList=new ArrayList<>();
        List<AnswerPaper>answerPaperList=new ArrayList<>();
        ParseInput parse=new ParseInput();
        List<String>a=new ArrayList<>();
        List<String>b=new ArrayList<>();
        List<String>c=new ArrayList<>();
        while(true){
            str=scanner.nextLine();
            if(str.matches("#N:.+#Q:.+#A:.+")){
                a.add(str);
            }
            else if(str.matches("#T:.+\\d+-\\d+.+")){
                b.add(str);
            }else if(str.matches("#S:.+")){
                c.add(str);
            }else if(str.equals("end")){
                break;
            }
        }

        for(String s:a){
            questionList.add(parse.questionMatching(s));
        }
        for(String s:b){
            paperList.add(parse.paperMatching(s,questionList));
        }
        int i=0;
        for(String s:c){
            AnswerPaper aa=parse.answerMatching(s,paperList);
            answerPaperList.add(aa);
            i++;
        }
        Collections.sort(paperList);
        Collections.sort(answerPaperList);
        for(Paper paper:paperList){
            int sum=0;
            for(Question question:paper.getArr()){
                sum+=question.getScore();
            }
            if(sum!=100){
                System.out.println("alert: full score of test paper"+paper.getN()+" is not 100 points");
            }
        }

        for(AnswerPaper answerPaper:answerPaperList){
            if(answerPaper==null){
                System.out.println("The test paper number does not exist");
                continue;
            }
            List<Integer>integerList=new ArrayList<>();
            for(Paper paper:paperList){
                if(answerPaper.getN()==paper.getN()){
                   for(Question question:paper.getArr()){
                       int flag=0;
                       for(Answer answer:answerPaper.getAnarr()){
                           if(question.getN()==answer.getN()){
                               flag=1;
                               if(question.getA().equals(answer.getstr())){
                                   System.out.println(question.getq()+"~"+answer.getstr()+"~true");
                                   integerList.add(question.getScore());
                               }else{
                                   System.out.println(question.getq()+"~"+answer.getstr()+"~false");
                                   integerList.add(0);
                               }
                           }
                       }
                       if(flag==0){
                           integerList.add(0);
                           System.out.println("answer is null");
                       }
                   }
                }
            }
            show(integerList);
        }
    }
    static void show(List<Integer> arr){
        int sum=0;
        String str="";
        for(int a:arr){
            sum+=a;
            str=str+a+" ";
        }
        str=str.replaceAll(" $","");
        str=str+"~"+sum;
        System.out.println(str);
    }

}

分析报告

Metrics Details For File 'ptatwo.java'
--------------------------------------------------------------------------------------------

Parameter                Value
=========                =====
Project Directory            C:\Users\11813\Desktop\java文件\
Project Name                2
Checkpoint Name                Baseline
File Name                ptatwo.java
Lines                    276
Statements                181
Percent Branch Statements        17.1
Method Call Statements            70
Percent Lines with Comments        0.0
Classes and Interfaces            6
Methods per Class            4.67
Average Statements per Method        4.64
Line Number of Most Complex Method    184
Name of Most Complex Method        Main.main()
Maximum Complexity            22
Line Number of Deepest Block        246
Maximum Block Depth            9+
Average Block Depth            2.43
Average Complexity            2.11

--------------------------------------------------------------------------------------------
Most Complex Methods in 6 Class(es):    Complexity, Statements, Max Depth, Calls

Answer.compareTo()            1, 1, 2, 1
Answer.getN()                1, 1, 2, 0
Answer.getstr()                1, 1, 2, 0
Answer.setN()                1, 1, 2, 0
Answer.setstr()                1, 1, 2, 0
AnswerPaper.compareTo()            1, 1, 2, 1
AnswerPaper.getAnarr()            1, 1, 2, 0
AnswerPaper.getN()            1, 1, 2, 0
AnswerPaper.setAnarr()            1, 1, 2, 0
AnswerPaper.setN()            1, 1, 2, 0
Main.main()                22, 56, 9, 39
Main.show()                2, 8, 3, 1
Paper.compareTo()            1, 1, 2, 1
Paper.getArr()                1, 1, 2, 0
Paper.getN()                1, 1, 2, 0
Paper.setArr()                1, 1, 2, 0
Paper.setN()                1, 1, 2, 0
ParseInput.answerMatching()        7, 22, 4, 10
ParseInput.paperMatching()        4, 16, 5, 15
ParseInput.questionMatching()        1, 3, 2, 0
Question.compareTo()            1, 1, 2, 1
Question.getA()                1, 1, 2, 0
Question.getN()                1, 1, 2, 0
Question.getq()                1, 1, 2, 0
Question.getScore()            1, 1, 2, 0
Question.isAnswer()            1, 1, 2, 1
Question.Question()            1, 3, 2, 0
Question.setScore()            1, 1, 2, 0

--------------------------------------------------------------------------------------------
Block Depth                Statements

0                    10
1                    41
2                    73
3                    27
4                    13
5                    4
6                    3
7                    3
8                    3
9+                    4
--------------------------------------------------------------------------------------------

image-20240419234428143

不难发现这次代码中明显复杂度很高

去代码中找原因:在main函数中有一段代码:

for(AnswerPaper answerPaper:answerPaperList){
            if(answerPaper==null){
                System.out.println("The test paper number does not exist");
                continue;
            }
            List<Integer>integerList=new ArrayList<>();
            for(Paper paper:paperList){
                if(answerPaper.getN()==paper.getN()){
                   for(Question question:paper.getArr()){
                       int flag=0;
                       for(Answer answer:answerPaper.getAnarr()){
                           if(question.getN()==answer.getN()){
                               flag=1;
                               if(question.getA().equals(answer.getstr())){
                                   System.out.println(question.getq()+"~"+answer.getstr()+"~true");
                                   integerList.add(question.getScore());
                               }else{
                                   System.out.println(question.getq()+"~"+answer.getstr()+"~false");
                                   integerList.add(0);
                               }
                           }
                       }
                       if(flag==0){
                           integerList.add(0);
                           System.out.println("answer is null");
                       }
                   }
                }
            }
            show(integerList);
        }
    }

这段代码有4个for循环———归结原因还是因为代码中许多数据类性都采用arraylist的结果,导致for—each循环过多,这个情况在第三次代码中有改良,我采用Hashmap的结构,直接通过索引来找数据,极大的降低了复杂度,具体步骤在第三次分析报告中在讲。

第三次大作业

题目

设计实现答题程序,模拟一个小型的测试,以下粗体字显示的是在答题判题程序-2基础上增补或者修改的内容,要求输入题目信息、试卷信息、答题信息、学生信息、删除题目信息,根据输入题目信息中的标准答案判断答题的结果。

输入格式:

程序输入信息分五种,信息可能会打乱顺序混合输入。

1、题目信息
题目信息为独行输入,一行为一道题,多道题可分多行输入。

格式:"#N:"+题目编号+" "+"#Q:"+题目内容+" "#A:"+标准答案

格式约束:
1、题目的输入顺序与题号不相关,不一定按题号顺序从小到大输入。
2、允许题目编号有缺失,例如:所有输入的题号为1、2、5,缺少其中的3号题。此种情况视为正常。
样例:#N:1 #Q:1+1= #A:2
#N:2 #Q:2+2= #A:4

2、试卷信息

试卷信息为独行输入,一行为一张试卷,多张卷可分多行输入数据。
格式:"#T:"+试卷号+" "+题目编号+"-"+题目分值+" "+题目编号+"-"+题目分值+...

格式约束:
题目编号应与题目信息中的编号对应。
一行信息中可有多项题目编号与分值。
样例:#T:1 3-5 4-8 5-2

3、学生信息

学生信息只输入一行,一行中包括所有学生的信息,每个学生的信息包括学号和姓名,格式如下。

格式:"#X:"+学号+" "+姓名+"-"+学号+" "+姓名....+"-"+学号+" "+姓名

格式约束:
答案数量可以不等于试卷信息中题目的数量,没有答案的题目计0分,多余的答案直接忽略,答案之间以英文空格分隔。
样例:
#S:1 #A:5 #A:22
1是试卷号
5是1号试卷的顺序第1题的题目答案
4、答卷信息

答卷信息按行输入,每一行为一张答卷的答案,每组答案包含某个试卷信息中的题目的解题答案,答案的顺序号与试 卷信息中的题目顺序相对应。答卷中:

格式:"#S:"+试卷号+" "+学号+" "+"#A:"+试卷题目的顺序号+"-"+答案内容+...

格式约束:
答案数量可以不等于试卷信息中题目的数量,没有答案的题目计0分,多余的答案直接忽略,答案之间以英文空格分隔。
答案内容可以为空,即””。
答案内容中如果首尾有多余的空格,应去除后再进行判断。
样例:
#T:1 1-5 3-2 2-5 6-9 4-10 7-3
#S:1 20201103 #A:2-5 #A:6-4
1是试卷号
20201103是学号
2-5中的2是试卷中顺序号,5是试卷第2题的答案,即T中3-2的答案
6-4中的6是试卷中顺序号,4是试卷第6题的答案,即T中7-3的答案
注意:不要混淆顺序号与题号

5、删除题目信息

删除题目信息为独行输入,每一行为一条删除信息,多条删除信息可分多行输入。该信息用于删除一道题目信息,题目被删除之后,引用该题目的试卷依然有效,但被删除的题目将以0分计,同时在输出答案时,题目内容与答案改为一条失效提示,例如:”the question 2 invalid~0”

格式:"#D:N-"+题目号

格式约束:

   题目号与第一项”题目信息”中的题号相对应,不是试卷中的题目顺序号。

   本题暂不考虑删除的题号不存在的情况。      

样例:
#N:1 #Q:1+1= #A:2
#N:2 #Q:2+2= #A:4
#T:1 1-5 2-8
#X:20201103 Tom-20201104 Jack
#S:1 20201103 #A:1-5 #A:2-4
#D:N-2
end

输出
alert: full score of test paper1 is not 100 points
1+1=5false
the question 2 invalid~0
20201103 Tom: 0 0~0
答题信息以一行"end"标记结束,"end"之后的信息忽略。

输出格式:

1、试卷总分警示

该部分仅当一张试卷的总分分值不等于100分时作提示之用,试卷依然属于正常试卷,可用于后面的答题。如果总分等于100 分,该部分忽略,不输出。

格式:"alert: full score of test paper"+试卷号+" is not 100 points"

样例:alert: full score of test paper2 is not 100 points

2、答卷信息

一行为一道题的答题信息,根据试卷的题目的数量输出多行数据。

格式:题目内容+""+答案++""+判题结果(true/false)

约束:如果输入的答案信息少于试卷的题目数量,答案的题目要输"answer is null"
样例:
3+2=5true
4+6=22false.
answer is null

3、判分信息

判分信息为一行数据,是一条答题记录所对应试卷的每道小题的计分以及总分,计分输出的先后顺序与题目题号相对应。

格式:**学号+" "+姓名+": "**+题目得分+" "+....+题目得分+"~"+总分

格式约束:

 1、没有输入答案的题目、被删除的题目、答案错误的题目计0分
 2、判题信息的顺序与输入答题信息中的顺序相同
样例:20201103 Tom: 0 0~0

   根据输入的答卷的数量以上2、3项答卷信息与判分信息将重复输出。

4、被删除的题目提示信息

当某题目被试卷引用,同时被删除时,答案中输出提示信息。样例见第5种输入信息“删除题目信息”。

5、题目引用错误提示信息

试卷错误地引用了一道不存在题号的试题,在输出学生答案时,提示”non-existent question~”加答案。例如:

输入:

#N:1 #Q:1+1= #A:2
#T:1 3-8
#X:20201103 Tom-20201104 Jack-20201105 Www
#S:1 20201103 #A:1-4
end

输出:
alert: full score of test paper1 is not 100 points
non-existent question~0
20201103 Tom: 0~0
如果答案输出时,一道题目同时出现答案不存在、引用错误题号、题目被删除,只提示一种信息,答案不存在的优先级最高,例如:
输入:
#N:1 #Q:1+1= #A:2
#T:1 3-8
#X:20201103 Tom-20201104 Jack-20201105 Www
#S:1 20201103
end

输出:
alert: full score of test paper1 is not 100 points
answer is null
20201103 Tom: 0~0

6、格式错误提示信息

输入信息只要不符合格式要求,均输出”wrong format:”+信息内容。

  例如:wrong format:2 #Q:2+2= #4

7、试卷号引用错误提示输出

如果答卷信息中试卷的编号找不到,则输出”the test paper number does not exist”,答卷中的答案不用输出,参见样例8。

8、学号引用错误提示信息

如果答卷中的学号信息不在学生列表中,答案照常输出,判分时提示错误。参见样例9。

本题暂不考虑出现多张答卷的信息的情况。

我的代码


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
class QuestionBase{
    private String name;//问题库名称
    private HashMap<Integer,Question>questionHashMap;

    public HashMap<Integer, Question> getQuestionHashMap() {
        return questionHashMap;
    }

    public void setQuestionHashMap(HashMap<Integer, Question> questionHashMap) {
        this.questionHashMap = questionHashMap;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}
class Question{
    private int num;// 题号
    private String content;//题目内容
     private String standardAnswer;// 标准答案
    boolean matchingStandardAnswers(String answer){
        return answer.equals(standardAnswer);
    }
private boolean is_delete;

    public boolean isIs_delete() {
        return is_delete;
    }

    public void setIs_delete(boolean is_delete) {
        this.is_delete = is_delete;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getStandardAnswer() {
        return standardAnswer;
    }

    public void setStandardAnswer(String standardAnswer) {
        this.standardAnswer = standardAnswer;
    }
}
class QuestionInPaper{
    private int score;//分数
    private Question question;//问题
    private int N;//在试卷中的位置
    int judge_markAnswer(String answer){
        if(question.matchingStandardAnswers(answer)){
            return score;
        }else{
            return 0;
        }
    }

    public int getN() {
        return N;
    }

    public void setN(int n) {
        N = n;
    }

    int getScore() {
        return score;
    }

    void setScore(int score) {
        this.score = score;
    }

    Question getQuestion() {
        return question;
    }

    void setQuestion(Question question) {
        this.question = question;
    }

}

class TextPaper{
    private  int N=-1;//试卷编号
    private int questionNum;// 题目数量
    private ArrayList<QuestionInPaper>questionInPaperArrayList=null;//根据题目的顺序构成的list
    private int SumScore=0;
    void inputQuestion( QuestionInPaper question){
        questionInPaperArrayList.add(question);
    }
    public int getSumScore() {
        return SumScore;
    }
    public void setSumScore(int sumScore) {
        SumScore = sumScore;
    }
    public void AddQuestion(QuestionInPaper question){
        this.questionInPaperArrayList.add(question);
        this.SumScore+=question.getScore();
    }//在原有的基础上add问题

    public ArrayList<QuestionInPaper> getQuestionInPaperArrayList() {
        return questionInPaperArrayList;
    }

    public void setQuestionInPaperArrayList(ArrayList<QuestionInPaper> questionInPaperArrayList) {
        this.questionInPaperArrayList = questionInPaperArrayList;
        int sum=0;
        for(QuestionInPaper question:questionInPaperArrayList){
            sum+=question.getScore();
        }
        this.SumScore=sum;
    }

    public int getQuestionNum() {
        return questionNum;
    }

    public void setQuestionNum(int questionNum) {
        this.questionNum = questionNum;
    }

    int getN() {
        return N;
    }

    void setN(int n) {
        N = n;
    }

}
class Answer{
    private String answer;
    private  int N;//在paper中的位置

    public String getAnswer() {
        return answer;
    }

    public void setAnswer(String answer) {
        this.answer = answer;
    }

    public int getN() {
        return N;
    }

    public void setN(int n) {
        N = n;
    }
}
class AnswerPaper{
    private int N;//答卷编号对应试卷编号
    private String StudentNumber;//该答卷中的学生学号
    private TextPaper textPaper;//答卷由试卷和答案组成
    private HashMap<Integer,String>answer;
    private ArrayList<Integer>scoreArr;

    public ArrayList<Integer> getScoreArr() {
        return scoreArr;
    }

    public void setScoreArr(ArrayList<Integer> scoreArr) {
        this.scoreArr = scoreArr;
    }

    private int score;

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public TextPaper getTextPaper() {
        return textPaper;
    }

    public void setTextPaper(TextPaper textPaper) {
        this.textPaper = textPaper;
    }

    public int getN() {
        return N;
    }

    public void setN(int n) {
        N = n;
    }

    public String getStudentNumber() {
        return StudentNumber;
    }

    public void setStudentNumber(String studentNumber) {
        StudentNumber = studentNumber;
    }

    public HashMap<Integer, String> getAnswer() {
        return answer;
    }

    public void setAnswer(HashMap<Integer, String> answer) {
        this.answer = answer;
    }
}
class Student{
    String ID;
    String name;

    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
class Parse {
    HashMap<Integer, Question> Toquestionhashmap(ArrayList<String> stringArrayList) {
        HashMap<Integer, Question> questionHashMap = new HashMap<>();
        for (String s : stringArrayList) {
            if (s.matches("^#N:\\d+\\s#Q:.+\\s#A:.*")) {
                Question question = new Question();
                Pattern pattern = Pattern.compile("#N:(\\d)+\\s#Q:(.+)\\s#A:(.*)");
                Matcher matcher = pattern.matcher(s);
                while (matcher.find()) {
                    String string = matcher.group(1);
                    question.setNum(Integer.parseInt(string));
                    question.setIs_delete(false);
                    question.setContent(matcher.group(2));
                    question.setStandardAnswer(matcher.group(3));
                }
                questionHashMap.put(question.getNum(), question);
            }
        }
        return questionHashMap;
    }

    HashMap<Integer, Question> DeleteQuestion(HashMap<Integer, Question> questionHashMap, ArrayList<String> stringArrayList) {
        for (String s : stringArrayList) {
            if (s.matches("#D:N-[1-9]\\d*")) {
                s = s.replaceAll("#D:N-", "");
                Question question = questionHashMap.get(Integer.parseInt(s));
                question.setIs_delete(true);
                questionHashMap.replace(Integer.parseInt(s), question);
            }
        }
        return questionHashMap;
    }

    HashMap<Integer, TextPaper> ToHashPaper(ArrayList<String> stringArrayList, HashMap<Integer, Question> questionHashMap) {
        HashMap<Integer,TextPaper>textPaperHashMap=new HashMap<>();
        for (String s : stringArrayList) {
            TextPaper textPaper = new TextPaper();
            if (s.matches("^#T:[1-9]\\d*(\\s[1-9]\\d*-[1-9]\\d*)*")) {
                ArrayList<QuestionInPaper> questionInPaperArrayList = new ArrayList<>();
                Pattern pattern = Pattern.compile("^#T:([1-9])");
                Matcher matcher = pattern.matcher(s);
                int n=0;
                while (matcher.find()) {
                    n = Integer.parseInt(matcher.group(1));
                }
                textPaper.setN(n);
                Pattern pattern1 = Pattern.compile("([1-9]\\d*)-([1-9]\\d*)");
                Matcher matcher1 = pattern1.matcher(s);
                int sum = 0;
                int i=1;
                while (matcher1.find()) {
                    String str1 = matcher1.group(1);//qusetionId
                    String str2 = matcher1.group(2);//feshu
                    QuestionInPaper questionInPaper = new QuestionInPaper();
                    if(questionHashMap.get(Integer.parseInt(str1))==null){
                        questionInPaper.setQuestion(null);
                    }else{
                        questionInPaper.setQuestion(questionHashMap.get(Integer.parseInt(str1)));
                    }
                    questionInPaper.setScore(Integer.parseInt(str2));
                    sum += Integer.parseInt(str2);
                    questionInPaper.setN(i);
                    i++;
                    questionInPaperArrayList.add(questionInPaper);
                }
                textPaper.setQuestionInPaperArrayList(questionInPaperArrayList);
                textPaper.setSumScore(sum);
                textPaper.setQuestionNum(questionInPaperArrayList.size());
                textPaperHashMap.put(textPaper.getN(),textPaper);
            }
        }
        return textPaperHashMap;
    }
    HashMap<String,Student> ToStudentHashmap(ArrayList<String>stringArrayList){
        HashMap<String ,Student>stringStudentHashMap=new HashMap<>();
        for(String str:stringArrayList){
            if(str.matches("^#X:.+")){
                Pattern pattern=Pattern.compile("(\\d{8})\\s([^-]+)");
                Matcher matcher=pattern.matcher(str);
                while(matcher.find()){
                    Student student=new Student();
                    student.setID(matcher.group(1));
                    student.setName(matcher.group(2));
                    stringStudentHashMap.put(matcher.group(1),student);
                }
            }
        }
        return stringStudentHashMap;
    }
    ArrayList<AnswerPaper> ToAnswerpaperArraylist(ArrayList<String> stringArrayList,HashMap<Integer,TextPaper> textPaperHashMap){
        ArrayList<AnswerPaper>answerPaperArrayList=new ArrayList<>();
        for(String str:stringArrayList){
             if(str.matches("^#S:[1-9]\\d*\\s\\d{8}.*")){
                AnswerPaper answerPaper=new AnswerPaper();
                Pattern pattern=Pattern.compile("^#S:([1-9]\\d*)\\s(\\d{8}).*");
                Matcher matcher=pattern.matcher(str);
                while(matcher.find()){
                    String str1=matcher.group(1);
                    String str2=matcher.group(2);
                    answerPaper.setN(Integer.parseInt(str1));
                    answerPaper.setTextPaper(textPaperHashMap.get(answerPaper.getN()));
                    answerPaper.setStudentNumber(str2);
                }
                Pattern pattern1=Pattern.compile("#A:([1-9]\\d*)-(\\d*)");
                Matcher matcher1=pattern1.matcher(str);
                HashMap<Integer,String>stringHashMap=new HashMap<>();
                while(matcher1.find()){
                    String str1=matcher1.group(1);
                    String str2=matcher1.group(2);
                    stringHashMap.put(Integer.parseInt(str1),str2);
                }
                answerPaper.setAnswer(stringHashMap);
                answerPaperArrayList.add(answerPaper);
            }
        }
        return answerPaperArrayList;
    }
    ArrayList<TextPaper> TotextPaperArrayList(ArrayList<String> stringArrayList, HashMap<Integer, Question> questionHashMap){
        ArrayList<TextPaper>textPaperArrayList=new ArrayList<>();
        for (String s : stringArrayList) {
            if (s.matches("^#T:[1-9]\\d*(\\s[1-9]\\d*-[1-9]\\d*)*")) {
                TextPaper textPaper = new TextPaper();
                ArrayList<QuestionInPaper> questionInPaperArrayList = new ArrayList<>();
                Pattern pattern = Pattern.compile("^#T:([1-9])");
                Matcher matcher = pattern.matcher(s);
                int n=0;
                while (matcher.find()) {
                    n = Integer.parseInt(matcher.group(1));
                }
                textPaper.setN(n);
                Pattern pattern1 = Pattern.compile("([1-9]\\d*)-([1-9]\\d*)");
                Matcher matcher1 = pattern1.matcher(s);
                int sum = 0;
                ArrayList<Integer> integers = new ArrayList<>();
                while (matcher1.find()) {
                    String str1 = matcher1.group(1);//qusetionId
                    String str2 = matcher1.group(2);//feshu
                    QuestionInPaper questionInPaper = new QuestionInPaper();
                    questionInPaper.setQuestion(questionHashMap.get(Integer.parseInt(str1)));
                    questionInPaper.setScore(Integer.parseInt(str2));
                    sum += Integer.parseInt(str2);
                    questionInPaperArrayList.add(questionInPaper);
                }
                textPaper.setQuestionInPaperArrayList(questionInPaperArrayList);
                textPaper.setSumScore(sum);
                textPaper.setQuestionNum(questionInPaperArrayList.size());
                textPaperArrayList.add(textPaper);
            }
        }
        return textPaperArrayList;
    }
}
class Show{
    void ShowWrongFormat(ArrayList<String>arrayList){
        for(String string:arrayList){
            if(string.matches("^#N:\\d+\\s#Q:.+\\s#A:.*")){
            }else if(string.matches("^#T:[1-9]\\d*(\\s[1-9]\\d*-[1-9]\\d*)*")){
            }else if(string.matches("^#X:.+")){
            }else if(string.matches("^#S:[1-9]\\d*\\s\\d{8}.*")){
            }else if(string.matches("#D:N-[1-9]\\d*")){
            }else{
                System.out.println("wrong format:"+string);
            }
        }
    }
    void ShowTextPaperScore(ArrayList<TextPaper>textPaperArrayList){
        for(TextPaper textPaper:textPaperArrayList){
            if(textPaper.getSumScore()!=100){
                System.out.println("alert: full score of test paper"+textPaper.getN()+" is not 100 points");
            }
        }
    }
    AnswerPaper show1(AnswerPaper answerPaper){
        int sum=0;
        TextPaper textPaper=answerPaper.getTextPaper();
        if(textPaper==null){
            System.out.println("The test paper number does not exist");
            return answerPaper;
        }
        ArrayList<Integer>arrayList=new ArrayList<>();
        HashMap<Integer, String> stringHashMap=answerPaper.getAnswer();
        for(QuestionInPaper questionInPaper:textPaper.getQuestionInPaperArrayList()){
            if(stringHashMap.get(questionInPaper.getN())==null){
                System.out.println("answer is null");
                arrayList.add(0);
            }else if(questionInPaper.getQuestion()==null){
                System.out.println("non-existent question~0");
                arrayList.add(0);
            }else if(questionInPaper.getQuestion().isIs_delete()){
                System.out.println("the question "+questionInPaper.getN()+" invalid~0");
                arrayList.add(0);
            } else if(questionInPaper.getQuestion().matchingStandardAnswers(stringHashMap.get(questionInPaper.getN()))){
                System.out.println(questionInPaper.getQuestion().getContent()+"~"+stringHashMap.get(questionInPaper.getN())+"~"+"true");
                sum+=questionInPaper.getScore();
                arrayList.add(questionInPaper.getScore());
            }else{
                System.out.println(questionInPaper.getQuestion().getContent()+"~"+stringHashMap.get(questionInPaper.getN())+"~"+"false");
                arrayList.add(0);
            }
        }
        answerPaper.setScoreArr(arrayList);
        answerPaper.setScore(sum);
        return answerPaper;
    }
    void show2(AnswerPaper answerPaper,HashMap<String,Student>stringStudentHashMap){
        if(answerPaper.getScoreArr()==null){
            return ;
        }
        int n=answerPaper.getScoreArr().size();
        if(stringStudentHashMap.get(answerPaper.getStudentNumber())==null){
            System.out.println(answerPaper.getStudentNumber()+" not found");
            return ;
        }
        int i=0;
        System.out.print(answerPaper.getStudentNumber()+" "+stringStudentHashMap.get(answerPaper.getStudentNumber()).getName()+": ");
        for(int j:answerPaper.getScoreArr()){
            System.out.print(j);
            if(i!=n-1){
                System.out.print(" ");
            }else{
                System.out.print("~");
            }
            i++;
        }
        System.out.println(answerPaper.getScore());
    }
}
class Main{
    static ArrayList<String> input(){
        Scanner scanner=new Scanner(System.in);
        String str4=null;
        ArrayList<String>stringArrayList=new ArrayList<>();
        while(true){
            str4=scanner.nextLine();
            if(str4.equals("end")){
                break;
            }
            stringArrayList.add(str4);
        }
        return stringArrayList;
    }
    public static void main(String[]args) {
        ArrayList<String> stringArrayList = input();//输入数据用list的方式保存
        HashMap<Integer, Question> questionHashMap = new HashMap<>();//question.N question
        Parse parse = new Parse();
        questionHashMap = parse.Toquestionhashmap(stringArrayList);
        questionHashMap=parse.DeleteQuestion(questionHashMap,stringArrayList);
        HashMap<Integer, TextPaper> textPaperHashMap = parse.ToHashPaper(stringArrayList, questionHashMap);
        HashMap<String, Student> stringStudentHashMap = parse.ToStudentHashmap(stringArrayList);
        ArrayList<AnswerPaper> answerPaperArrayList = parse.ToAnswerpaperArraylist(stringArrayList, textPaperHashMap);
        ArrayList<TextPaper> textPaperArrayList = parse.TotextPaperArrayList(stringArrayList, questionHashMap);
        Show show = new Show();
        show.ShowWrongFormat(stringArrayList);
        show.ShowTextPaperScore(textPaperArrayList);
        for (AnswerPaper answerPaper : answerPaperArrayList) {
            answerPaper=show.show1(answerPaper);
            show.show2(answerPaper, stringStudentHashMap);
        }
    }
}

分析报告

Metrics Details For File 'ptathree.java'
--------------------------------------------------------------------------------------------

Parameter				Value
=========				=====
Project Directory			C:\Users\11813\Desktop\java文件\
Project Name				2
Checkpoint Name				Baseline
File Name				ptathree.java
Lines					512
Statements				347
Percent Branch Statements		14.1
Method Call Statements			156
Percent Lines with Comments		3.9
Classes and Interfaces			10
Methods per Class			6.10
Average Statements per Method		5.11
Line Number of Most Complex Method	403
Name of Most Complex Method		Show.show1()
Maximum Complexity			8
Line Number of Deepest Block		305
Maximum Block Depth			6
Average Block Depth			2.46
Average Complexity			1.85

--------------------------------------------------------------------------------------------
Most Complex Methods in 9 Class(es):	Complexity, Statements, Max Depth, Calls

Answer.getAnswer()			1, 1, 2, 0
Answer.getN()				1, 1, 2, 0
Answer.setAnswer()			1, 1, 2, 0
Answer.setN()				1, 1, 2, 0
AnswerPaper.getAnswer()			1, 1, 2, 0
AnswerPaper.getN()			1, 1, 2, 0
AnswerPaper.getScore()			1, 1, 2, 0
AnswerPaper.getScoreArr()		1, 1, 2, 0
AnswerPaper.getStudentNumber()		1, 1, 2, 0
AnswerPaper.getTextPaper()		1, 1, 2, 0
AnswerPaper.setAnswer()			1, 1, 2, 0
AnswerPaper.setN()			1, 1, 2, 0
AnswerPaper.setScore()			1, 1, 2, 0
AnswerPaper.setScoreArr()		1, 1, 2, 0
AnswerPaper.setStudentNumber()		1, 1, 2, 0
AnswerPaper.setTextPaper()		1, 1, 2, 0
Main.input()				3, 8, 3, 3
Main.main()				2, 14, 3, 9
Parse.DeleteQuestion()			3, 7, 4, 7
Parse.ToAnswerpaperArraylist()		5, 22, 5, 14
Parse.ToHashPaper()			7, 33, 6, 29
Parse.Toquestionhashmap()		4, 14, 5, 14
Parse.ToStudentHashmap()		4, 11, 5, 9
Parse.TotextPaperArrayList()		5, 28, 5, 26
Question.getContent()			1, 1, 2, 0
Question.getNum()			1, 1, 2, 0
Question.getStandardAnswer()		1, 1, 2, 0
Question.isIs_delete()			1, 1, 2, 0
Question.matchingStandardAnswers()	1, 1, 2, 1
Question.setContent()			1, 1, 2, 0
Question.setIs_delete()			1, 1, 2, 0
Question.setNum()			1, 1, 2, 0
Question.setStandardAnswer()		1, 1, 2, 0
QuestionBase.getName()			1, 1, 2, 0
QuestionBase.getQuestionHashMap()	1, 1, 2, 0
QuestionBase.setName()			1, 1, 2, 0
QuestionBase.setQuestionHashMap()	1, 1, 2, 0
Show.show1()				8, 27, 4, 23
Show.show2()				6, 16, 4, 10
Show.ShowTextPaperScore()		3, 3, 4, 2
Show.ShowWrongFormat()			8, 8, 4, 6
Student.getID()				1, 1, 2, 0
Student.getName()			1, 1, 2, 0
Student.setID()				1, 1, 2, 0
Student.setName()			1, 1, 2, 0
TextPaper.AddQuestion()			1, 2, 2, 1
TextPaper.getN()			1, 1, 2, 0
TextPaper.getQuestionInPaperArrayList()	1, 1, 2, 0
TextPaper.getQuestionNum()		1, 1, 2, 0
TextPaper.getSumScore()			1, 1, 2, 0
TextPaper.inputQuestion()		1, 1, 2, 1
TextPaper.setN()			1, 1, 2, 0
TextPaper.setQuestionInPaperArrayList()	2, 5, 3, 0
TextPaper.setQuestionNum()		1, 1, 2, 0
TextPaper.setSumScore()			1, 1, 2, 0

--------------------------------------------------------------------------------------------
Block Depth				Statements

0					22
1					84
2					101
3					34
4					68
5					36
6					2
7					0
8					0
9+					0
--------------------------------------------------------------------------------------------

image-20240419235910119

在这里我们可以明显的观察到代码复杂度的下降,在这里讲下我的设计思路

  • 问题库:包括QuestionBase、Question、QuestionInPaper和TextPaper等类。QuestionBase类表示问题库的基本信息,Question类表示具体的问题,QuestionInPaper类表示试卷中的问题,TextPaper类表示试卷的基本信息。
  • 答卷:包括Answer、AnswerPaper和Student等类。Answer类表示学生的答案,AnswerPaper类表示学生的答卷,Student类表示学生的基本信息。
  • 解析:包括Parse和Show等类。Parse类用于将输入的字符串解析为试卷、问题和答案等信息,Show类用于显示解析结果和学生答卷的得分情况。
  • 主函数:在Main类中,通过调用Parse类的各种方法,将用户输入的字符串转换为系统中的各种对象,并通过Show类显示最终结果。

输入:#N:2 #Q:2+2= #A:4
#N:1 #Q:1+1= #A:2
#T:1 1-5 2-8
#X:20201103 Tom-20201104 Jack-20201105 Www
#S:1 20201103 #A:2-4 #A:1-5
#D:N-2
end

image

先存储在StringArraylist中

image

在通过questionHashMap=parse.DeleteQuestion(questionHashMap,stringArrayList)

得到questionHashMap

image

在通过HashMap<Integer, TextPaper> textPaperHashMap = parse.ToHashPaper(stringArrayList, questionHashMap);

得到textPaperHashMap

image

在通过ArrayList answerPaperArrayList = parse.ToAnswerpaperArraylist(stringArrayList, textPaperHashMap)

得到answerPaperArrayList

image

在通过:ArrayList textPaperArrayList = parse.TotextPaperArrayList(stringArrayList, questionHashMap);

得到 textPaperArrayList


到这里数据处理的差不多了

show.ShowWrongFormat(stringArrayList);
        show.ShowTextPaperScore(textPaperArrayList);
        for (AnswerPaper answerPaper : answerPaperArrayList) {
            answerPaper=show.show1(answerPaper);
            show.show2(answerPaper, stringStudentHashMap);
        }

接下来就是创建一个类show

并且调用show的方法来对数据进行output

在这里虽然题目中说明了单一试卷,但我却是用Answerpaperlist来存储数据

方便以后扩张

采坑心得

在我的代码没有完善前的大多数报错基本都是空指针造成的

例如这段代码

void show2(AnswerPaper answerPaper,HashMap<String,Student>stringStudentHashMap){
        if(answerPaper.getScoreArr()==null){
            return ;
        }
        int n=answerPaper.getScoreArr().size();
        if(stringStudentHashMap.get(answerPaper.getStudentNumber())==null){
            System.out.println(answerPaper.getStudentNumber()+" not found");
            return ;
        }
        int i=0;
        System.out.print(answerPaper.getStudentNumber()+" "+stringStudentHashMap.get(answerPaper.getStudentNumber()).getName()+": ");
        for(int j:answerPaper.getScoreArr()){
            System.out.print(j);
            if(i!=n-1){
                System.out.print(" ");
            }else{
                System.out.print("~");
            }
            i++;
        }
        System.out.println(answerPaper.getScore());
    }

在之前我没有加这个

if(answerPaper.getScoreArr()==null){
            return ;
        }

image

当answerPaper.getScoreArr()==null时

for(int j:answerPaper.getScoreArr())

将会遇到空指针

然后报错


改进建议

为了方便以后扩张,我们在存储数据时可以使用arraylist

在以后问题变多了以后,我们可以加一个试题库

多张试卷多张答卷多次输出

可以设置多选题

类与类之间的关联要小,低耦合

总结

学会了ArrayList的基本用法,还有HashMap的基本用法——通过索引快速找到Value,在数据处理方面使用了正则表达式来限制String,以此在这段时间内我去学习了正则表达式的基本用法,还有两个类——Pattern,Matcher,一个类用来决定匹配字符串的格式,一个类用来匹配字符串,在此期间我感觉自己对调试代码的能力有显著的提升。

对应类与类之间的设计可能还是有所欠缺,需要在仔细琢磨琢磨,自己还是太菜了,需要多学习,紧跟课程。

posted @ 2024-04-20 01:27  醒着做梦~  阅读(14)  评论(0编辑  收藏  举报