7-10周综合性总结(21202105-江向斌)
1.前言:
本阶段pta中主要关于java语言的基本程序设计,知识点涉及从最基础的命名变量到对象和类,其中包括了选择结构,循环结构,数学函数,字符和字符串以及方法的定义与调用,还有数组的使用等内容。题量适中,均能在规定时间内做完,但不一定能做全对。难度循序渐进,从第一次的基础题目到第三次的进阶题目,普遍基本思路不难,但是一开始敲击代码就会发现细节很难把握到位,尤其是有关于输入测试的部分尤为突出,明显很难考虑到每一个方面以至于无法拿到满分,总会有测试点过不了。第三次题目最难,不但体现于输入方面,在整体计算中也有体现,涉及不少数学知识,无论是第二道题目的凸四边形的计算都不简单,转化为代码后更加复杂,需要一定的时间来解决。
超星中的实验主要是针对了多个类的运用,强调有关于数据的封装还有java语言的其他两大特性,继承以及多态。通过农夫过河游戏的巧妙设计,我们能更好的理解这些。题量不算大,并且给我们的时间也很多,难度适中,涉及的知识点虽然都是刚学的或还没学的但是题目难度不难也不深入。并且超星系统因为其独特的功能,预防了我们复制粘贴的行为的发生,并且超星系统上直接写代码,也比在eclipse上写代码更加锻炼我们的语法能力和代码的规范意识。
期中考试主要涉及的知识点是java中的三大特性,封装和继承还有多态。题量不大,而且每道题目都是前面一道题目的延申,并且也给了输出格式的提醒,总体来说期中考试难度不大。涉及到的知识点也主要是类的设计等,在一些细的地方考的不多,而且给了2个半小时的时间,相当充裕。
总的来说,Java又是我们本学期第一次接触的语言,对Java语言的运用还有些许生疏,对语法的理解和java整体的结构把握不够清晰以及有关与行间距的习惯等还有很大进步空间,需要加强训练以求熟练。
2.设计分析:
PTA大作业四
7-1 sdut-String-2 识蛟龙号载人深潜,立科技报国志(II)(正则表达式):
1 import java.util.Scanner; 2 3 public class Main{ 4 public static void main(String []args) { 5 Scanner in =new Scanner(System.in); 6 String str = null; 7 8 while(str != "end"){ 9 str =in.nextLine(); 10 int sum = 0; 11 int flag = 0; 12 int m = 0; 13 14 if(str.length()<=80){ 15 if(str.equals("end")) 16 flag = 1; 17 for(int i = 0;i<str.length();i++){ 18 if(str.charAt(i)>='0'&&str.charAt(i)<='9'){ 19 for(int j = i;j<str.length()&&str.charAt(j)>='0'&&str.charAt(j)<='9';j++){ 20 m = j; 21 } 22 sum = Integer.parseInt(str.substring(i,m+1))+sum; 23 i = m; 24 } 25 } 26 if(flag == 0) 27 System.out.println(sum); 28 } 29 } 30 } 31 }
本题难点主要体现在对正则表达式的陌生。
代码分析:1.输入判断:
- 读入关于蛟龙号载人潜水器探测数据的多行字符串,每行字符不超过80个字符。
- 以"end"结束。
2.数据处理:
- 判断输入中的数据是否每行不超过80个字符。
- 运用循环语句,将每行数据单独提取作为一个独立的字符串,然后单独分析此一行数据。
- 在对字符串进行分析,若为数字则强制类型转换为整型,并且相加。
- 当读到此行数据为"end"时结束循环
3.输出处理:
- 每行数据都单独对应一个数据单行输出。
7-2 点线形系列4-凸四边形的计算
1 import java.util.Scanner; 2 import java.util.regex.Pattern; 3 import java.util.regex.Matcher; 4 public class Main{ 5 public static void main(String[] args) 6 { 7 Scanner scan = new Scanner(System.in); 8 String s; 9 int flag = 1; 10 s= scan.nextLine(); 11 String regex = "[1-5]:[+-]?([1-9][0-9]*|0),[+-]?([1-9][0-9]*|0)+( [+-]?([1-9][0-9]*|0),[+-]?([1-9][0-9]*|0))*[ ]*"; 12 Pattern p = Pattern.compile(regex); 13 Matcher m = p.matcher(s); 14 boolean df = m.matches(); 15 16 17 if(df==false) 18 { 19 System.out.print("Wrong Format"); 20 } 21 else 22 { 23 if(s.charAt(0)=='1'||s.charAt(0)=='2'||s.charAt(0)=='3') 24 { 25 String s1 = s.substring(2,s.length()); 26 String[] points =s1.split(" "); 27 String[] a = points[0].split(","); 28 String[] b = points[1].split(","); 29 String[] c = points[2].split(","); 30 String[] d = points[3].split(","); 31 double[] x = new double[4]; 32 double[] y = new double[4]; 33 x[0] = Double.parseDouble(a[0]); 34 x[1] = Double.parseDouble(b[0]); 35 x[2] = Double.parseDouble(c[0]); 36 x[3] = Double.parseDouble(d[0]); 37 y[0] = Double.parseDouble(a[1]); 38 y[1] = Double.parseDouble(b[1]); 39 y[2] = Double.parseDouble(c[1]); 40 y[3] = Double.parseDouble(d[1]); 41 boolean coincide = false; 42 for(int i = 0;i<4;i++) 43 { 44 for(int j = i+1;j<4;j++) 45 { 46 if(x[i]==x[j]&&y[i]==y[j]) 47 { 48 coincide = true; 49 } 50 } 51 } 52 if(coincide) 53 { 54 System.out.print("not a quadrilateral"); 55 } 56 else 57 { 58 int flag1 = 1,flag2 = 0; 59 if ((y[3] - y[2]) * (x[3] - x[1]) == (y[3] - y[1]) * (x[3] - x[2])) 60 flag1 = 0; 61 else if ((y[3] - y[2]) * (x[3] - x[0]) == (y[3] - y[0]) * (x[3 ]- x[2])) 62 flag1 = 0; 63 else if ((y[3] - y[1]) * (x[3] - x[0]) == (y[3] - y[0]) * (x[3] - x[1])) 64 flag1 = 0; 65 else if ((y[2] - y[1]) * (x[2] - x[0]) == (y[2] - y[0]) * (x[2] - x[1])) 66 flag1 = 0; 67 if((y[3]-y[0])*(x[2]-x[1])==(y[2]-y[1])*(x[3]-x[0])&&(y[3]-y[2])*(x[0]-x[1])==(y[0]-y[1])*(x[3]-x[2])) 68 { 69 flag2 = 1; 70 } 71 else 72 { 73 flag2 = 0; 74 } 75 if(s.charAt(0)=='1') 76 { 77 if(flag1 == 1) 78 { 79 System.out.print("true "); 80 } 81 else 82 { 83 System.out.print("false "); 84 } 85 if(flag2==1) 86 { 87 System.out.print("true"); 88 } 89 else 90 { 91 System.out.print("false"); 92 } 93 } 94 else if(s.charAt(0)=='2') 95 { 96 if(flag1==0) 97 { 98 System.out.print("not a quadrilateral"); 99 } 100 else { 101 if(flag2==0) 102 { 103 System.out.print("false false false"); 104 } 105 else 106 { 107 int flag3 = 0,flag4 = 0; 108 if((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0])==(x[3]-x[0])*(x[3]-x[0])+(y[3]-y[0])*(y[3]-y[0])) 109 { 110 flag3 = 1; 111 } 112 if((x[1]-x[0])*(x[3]-x[0])+(y[1]-y[0])*(y[3]-y[0])==0) 113 { 114 flag4 = 1; 115 } 116 if(flag3!=1&&flag4!=1) 117 { 118 System.out.print("false false false"); 119 } 120 else if(flag3==1&&flag4!=1) 121 { 122 System.out.print("true false false"); 123 } 124 else if(flag3!=1&&flag4==1) 125 { 126 System.out.print("false true false"); 127 } 128 else 129 { 130 System.out.print("true true true"); 131 } 132 } 133 } 134 } 135 else if(s.charAt(0)=='3') 136 { 137 if(flag1==0) 138 { 139 System.out.print("not a quadrilateral"); 140 } 141 else 142 { 143 double t1 = (x[3]-x[0])*(y[1]-y[0])-(y[3]-y[0])*(x[1]-x[0]); 144 double t2 = (x[0]-x[1])*(y[2]-y[1])-(y[0]-y[1])*(x[2]-x[1]); 145 double t3 = (x[1]-x[2])*(y[3]-y[2])-(y[1]-y[2])*(x[3]-x[2]); 146 double t4 = (x[2]-x[3])*(y[0]-y[3])-(y[2]-y[3])*(x[0]-x[3]); 147 if(t1*t2*t3*t4<0) 148 { 149 System.out.print("false "); 150 } 151 else 152 { 153 System.out.print("true "); 154 } 155 double chang = Math.sqrt((x[1]-x[0])*(x[1]-x[0])+(y[1]-y[0])*(y[1]-y[0]))+Math.sqrt((x[2]-x[1])*(x[2]-x[1])+(y[2]-y[1])*(y[2]-y[1]))+Math.sqrt((x[3]-x[2])*(x[3]-x[2])+(y[3]-y[2])*(y[3]-y[2]))+Math.sqrt((x[0]-x[3])*(x[0]-x[3])+(y[0]-y[3])*(y[0]-y[3])); 156 int chang1 = (int)(chang*1000+0.5); 157 chang = chang1/1000.0; 158 System.out.print(chang+" "); 159 double mianji=0.0; 160 for(int ii = 1 ; ii< 4 ; ii++) 161 { 162 mianji+=(x[ii-1]*y[ii]-x[ii]*y[ii-1]); 163 } 164 mianji+=x[3]*y[0]-x[0]*y[3]; 165 mianji= Math.abs(0.5*mianji); 166 int mianji1 = (int)(mianji*1000+0.5); 167 mianji = mianji1/1000.0; 168 System.out.print(mianji); 169 } 170 } 171 172 } 173 } 174 if(s.charAt(0)=='4') 175 { 176 System.out.println("not a quadrilateral or triangle"); 177 } 178 if(s.charAt(0)=='5') 179 { 180 System.out.println("in the triangle"); 181 } 182 } 183 } 184 }
本题难点主要体现:
- 输入的判断,输入中有空格和字符","的出现,对输入判断不方便。
- 判断是否是四边形、平行四边形。
- 判断是否是菱形、矩形、正方形。
- 判断是凹四边形(false)还是凸四边形(true),输出四边形周长、面积。
- 判断前两个点所构成的直线与后两点构成的直线是否平行,输出true或者false。
- 输入六个点坐标,前两个点构成一条直线,后四个点构成一个四边形或三角形,输出直线与四边形(也可能是三角形)相交的交点数量。如果交点有两个,再按面积从小到大输出四边形(或三角形)被直线分割成两部分的面积(不换行)。若直线与四边形或三角形的一条边线重合。
代码分析:1.输入判断:
- 输入数据第一位必须是数字且为1-5。
- 第二位必须为":"。
- 输入的点的坐标必须和输入的第一位数字的对应情况对应。。
- 两个点的坐标之间以空格分隔。
- 每个点的x,y坐标以英文“,”分隔。
- 每个数字前"+","-"只能有一个。
- 必须符合基本格式:选项+":"+坐标x+","+坐标y+" "+坐标x+","+坐标y。
2.数据处理:
- 定义一个字符串str,将输入数据存入其中。
- 定义一个int类型的变量存储str第一位数字。
- 对所给数据进行基本判断,看其是否符合基本格式。
- 运动switch语句,根据int所读入的数字确定为那种情况。
- 根据不同的情况判断输入数据是否符合规定。
- 若为情况1判断是否是四边形、平行四边形,判断结果输出true/false,结果之间以一个英文空格符分隔。
- 若为情况2判断是否是菱形、矩形、正方形,判断结果输出true/false,结果之间以一个英文空格符分隔。 若四个点坐标无法构成四边形,输出"not a quadrilateral"
- 若为情况3判断是凹四边形(false)还是凸四边形(true),输出四边形周长、面积,结果之间以一个英文空格符分隔。 若四个点坐标无法构成四边形,输出"not a quadrilateral"
- 若为情况4则输入六个点坐标,前两个点构成一条直线,后四个点构成一个四边形或三角形,输出直线与四边形(也可能是三角形)相交的交点数量。如果交点有两个,再按面积从小到大输出四边形(或三角形)被直线分割成两部分的面积(不换行)。若直线与四边形或三角形的一条边线重合,输出"The line is coincide with one of the lines"。若后四个点不符合四边形或三角形的输入,输出"not a quadrilateral or triangle"。
- 若为情况5则输入五个点坐标,输出第一个是否在后四个点所构成的四边形(限定为凸四边形,不考虑凹四边形)或三角形(判定方法见选项4)的内部(若是四边形输出in the quadrilateral/outof the quadrilateral,若是三角形输出in the triangle/outof the triangle)。如果点在多边形的某条边上,输出"on the triangle或者on the quadrilateral"。若后四个点不符合四边形或三角形,输出"not a quadrilateral or triangle"。。
3.输出处理:
- 如果不符合基本格式,输出"Wrong Format"。
- 如果符合基本格式,但输入点的数量不符合要求,输出"wrong number of points"。
- 不论哪个选项,如果格式、点数量都符合要求,但构成任一条线的两个点坐标重合,输出"points coincide"。
- 若四个点坐标无法构成四边形,输出"not a quadrilateral"
7-3 设计一个银行业务类
1 import java.util.Scanner; 2 3 public class Main{ 4 public static void main(String []args) { 5 Scanner in =new Scanner(System.in); 6 String name; 7 String key; 8 int balance; 9 10 name = in.next(); 11 key = in.next(); 12 BankBusiness account = new BankBusiness(name,key); 13 14 key = in.next(); 15 balance = in.nextInt(); 16 account.deposit(key,balance); 17 18 key = in.next(); 19 balance = in.nextInt(); 20 account.withdrawal(key,balance); 21 22 key = in.next(); 23 balance = in.nextInt(); 24 account.withdrawal(key,balance); 25 26 key = in.next(); 27 balance = in.nextInt(); 28 account.withdrawal(key,balance); 29 30 account.end(); 31 } 32 } 33 class BankBusiness{ 34 private String name; 35 private String key; 36 private double balance; 37 38 BankBusiness(String name,String key){ 39 this.name = name; 40 this.key = key; 41 balance = 0; 42 System.out.println("中国银行欢迎您的到来!"); 43 } 44 45 public void deposit(String key,double balance){ 46 if(this.key.equals(key)){ 47 this.balance = balance; 48 System.out.println("您的余额有"+balance+"元。"); 49 } 50 else 51 System.out.println("您的密码错误!"); 52 } 53 54 public void withdrawal(String key,double balance){ 55 if(this.key.equals(key)){ 56 if(balance<this.balance){ 57 this.balance = this.balance - balance; 58 System.out.println("请取走钞票,您的余额还有"+this.balance+"元。"); 59 } 60 else 61 System.out.println("您的余额不足!"); 62 } 63 else 64 System.out.println("您的密码错误!"); 65 } 66 67 public void end(){ 68 System.out.println("请收好您的证件和物品,欢迎您下次光临!"); 69 } 70 }
本题难点主要体现在多个类的设计问题,要熟练使用多个类,涉及到账号密码,还有数据的封装,存储,更改,使用等问题。
代码分析:1.输入判断:
- 输入开户需要的姓名、密码
- 输入正确密码、存款金额
- 输入错误密码、取款金额
- 输入正确密码、大于余额的取款金额
- 输入正确密码、小于余额的取款金额
2.数据处理:
- 首先将用户的账号,密码分别提取为两串字符串,将这两组数据对比,如果符合后台数据。
- 在对用户输入的金额与后台数据对比。
- 根据输入的数据来输出相应的内容
3.输出处理:
- 中国银行(银行名称)欢迎您的到来!
您的余额有多少元。
您的密码错误!
您的余额不足!
请取走钞票,您的余额还有多少元。
请收好您的证件和物品,欢迎您下次光临!
期中考试
7-1 点与线(类设计)
7-2 点线面问题重构(继承与多态)
7-3 点线面问题再重构(容器类)
1 import java.util.Scanner; 2 3 import java.util.ArrayList; 4 5 public class Main { 6 public static void main(String[] args) { 7 Scanner in=new Scanner(System.in); 8 double x1,x2,y1,y2; 9 String color; 10 int flag = 1; 11 int choice; 12 if(flag == 1){ 13 GeometryObject geo=new GeometryObject(); 14 Point point1; 15 Point point2; 16 Line line; 17 Plane plane; 18 Element element; 19 choice = in.nextInt(); 20 for(;choice!=0;){ 21 switch(choice) { 22 case 1://insert Point object into list 23 x1=in.nextDouble(); 24 y1=in.nextDouble(); 25 point1=new Point(x1,y1); 26 element=point1; 27 geo.add(element); 28 break; 29 case 2://insert Line object into list 30 x1=in.nextDouble(); 31 y1=in.nextDouble(); 32 x2=in.nextDouble(); 33 y2=in.nextDouble(); 34 color=in.next(); 35 point1=new Point(x1,y1); 36 point2=new Point(x2,y2); 37 line=new Line(point1,point2,color); 38 element=line; 39 geo.add(element); 40 break; 41 case 3://insert Plane object into list 42 color=in.next(); 43 plane=new Plane(color); 44 element=plane; 45 geo.add(element); 46 break; 47 case 4://delete index - 1 object from list 48 int index = in.nextInt(); 49 geo.remove(index); 50 } 51 choice = in.nextInt(); 52 } 53 geo.getList(); 54 } 55 if(flag == 0) 56 System.out.println("Wrong Format"); 57 } 58 } 59 60 abstract class Element{ 61 62 abstract void display(); 63 } 64 65 class Point extends Element{ 66 private double x,y; 67 68 public Point() { 69 70 } 71 72 public Point(double x, double y) { 73 this.x = x; 74 this.y = y; 75 } 76 public void setX() { 77 this.x = x; 78 79 } 80 81 public void setY() { 82 this.y = y; 83 } 84 85 public double getX() { 86 87 return x; 88 89 } 90 91 public double getY() { 92 93 return y; 94 95 } 96 97 public void display() { 98 System.out.println(String.format("(%.2f,%.2f)",this.x,this.y)); 99 100 } 101 102 } 103 class Line extends Element{ 104 private Point p1,p2; 105 private String color; 106 107 public Line() { 108 109 } 110 public Line(Point p3,Point p4,String color){ 111 p1 = p3; 112 p2 = p4; 113 this.color = color; 114 } 115 116 public Point getPoint1() { 117 return p1; 118 } 119 120 public void setPoint1(Point p1) { 121 this.p1 = p1; 122 } 123 124 public Point getPoint2() { 125 return p2; 126 } 127 128 public void setPoint2(Point p2) { 129 this.p2 = p2; 130 } 131 132 public String getColor() { 133 return color; 134 } 135 136 public void setColor(String color) { 137 this.color = color; 138 } 139 140 public double getDistance(){ 141 return Math.sqrt(Math.pow((p1.getX()-p2.getX()),2)+Math.pow((p1.getY()-p2.getY()),2)); 142 } 143 144 public void display(){ 145 System.out.println("The line's color is:"+color); 146 System.out.println("The line's begin point's Coordinate is:"); 147 p1.display(); 148 System.out.println("The line's end point's Coordinate is:"); 149 p2.display(); 150 System.out.println("The line's length is:"+String.format("%.2f", getDistance())); 151 } 152 153 154 } 155 156 157 158 class Plane extends Element{ 159 private String color; 160 161 public Plane() { 162 } 163 164 public Plane(String color) { 165 this.color = color; 166 } 167 168 public String getColor() { 169 return color; 170 } 171 172 public void setColor(String color) { 173 this.color = color; 174 } 175 void display() { 176 System.out.println("The Plane's color is:"+getColor()); 177 } 178 } 179 180 class GeometryObject{ 181 ArrayList<Element> list=new ArrayList<Element>(); 182 183 public GeometryObject() { 184 } 185 public void add(Element element){ 186 list.add(element); 187 } 188 public void remove(int index){ 189 list.remove(index-1); 190 } 191 public void getList(){ 192 for (int i=0;i<list.size();i++) { 193 Element e = new Element(); 194 e = list.get(i); 195 e.display(); 196 } 197 } 198 }
代码分析:1.输入判断:
- 输入数据必须满足11位及以上且必须有起始位"0"。
2.数据处理:
- 判断输入中的数据是否大于11位,若小于11位则数据中一定没有有效数据。
- 起始位的判断,先将数据从第一个开始读到倒数第10位,若其中有"0",则输入中有有效数据。
- 定义一个int类型的数组time和一个string类型的数组str,从第一个起始位开始将后面11位全存入str数组中,后找到第二个起始位......以此类推
- 得到不同的有效数据后进行奇偶校验和结束符检验,结束符必须为"1"且奇偶效验采用奇效验,若8位数据中的前6位里"1"的个数为奇数则第7位数据为"0",反之若前6位里"1"的个数为偶数则第7位数据为"1"。
3.输出处理:
- 若数据不足11位或者输入数据全1没有起始位,则输出"null data"。
- 若某个数据的结束符不为1,则输出"validate error"。
- 若某个数据奇偶校验错误,则输出"parity check error"。
- 若数据结束符和奇偶校验均不合格,则输出"validate error"。
- 若有多个数据,每个数据单独一行显示。
3.踩坑心得:
1.对输入的判断一定要谨慎,尤其是最后一次的三道题目,一开始我都是拿不到满分,后来发现多多少少都有受到输入的影响!尤其是第一道题,输入判断不只是对" " , "," , "+"此三个符号的判断还有很容易忽略的".",所以发现了此问题后我就加上了一段新代码。
1 for(int i = 0;i<4;i++){ 2 2 if(a[i].charAt(0)=='+'||a[i].charAt(0)=='-') 3 3 { 4 4 if(a[i].charAt(1)=='0'&&a[i].charAt(2)!='.') 5 5 { 6 6 flag1=0; 7 7 } 8 8 } 9 9 else 10 10 { 11 11 if(a[i].length()>=2) 12 12 { 13 13 if(a[i].charAt(0)=='0'&&a[i].charAt(1)!='.') 14 14 { 15 15 flag1=0; 16 16 } 17 17 } 18 18 } 19 19 if(flag1==0) 20 20 { 21 21 22 22 break; 23 23 } 24 24 } 25 25 if(flag1==0) 26 26 { 27 27 System.out.println("Wrong Format"); 28 28 }
此段代码尤为重要,是对"."的判断,若无此段代码则会出现譬如"+2.+"之类的格式错误。
2.对输出的小数点的控制,若想输出15为小数则需要使用println且需要时double类型的数据,如果用的是print则会自动保留两位小数导致输出不符合格式。
3.数学方法的运用,无论是第二题还是第三题,若选对了合适的数学方法,对整体数据的处理以及计算都会方便很多。譬如7-2的第二种情况,若使用两点式表达此直线在将其化为一般是,并求出对应A,B,C后在代入公式,整体思路会更简单。
1 else{ 2 2 double [] arr = new double[count*2]; 3 3 for(int i = 0;i<count*2;i++) 4 4 arr[i] = Double.parseDouble(a[i]); 5 5 flag = panduan(arr[0],arr[1],arr[2],arr[3]); 6 6 flag = panduan(arr[0],arr[1],arr[4],arr[5]); 7 7 flag = panduan(arr[2],arr[3],arr[4],arr[5]); 8 8 if(flag){ 9 9 A = arr[5] - arr[3]; 10 10 B = arr[2] - arr[4]; 11 11 C = arr[4]*arr[3] - arr[5]*arr[2]; 12 12 double distance = (Math.abs(A*arr[0] + B*arr[1] + C)) / (Math.sqrt(A*A + B*B)); 13 13 System.out.println(distance); 14 14 } 15 15 else 16 16 System.out.println("points coincide"); 17 17 } 18 18 } 19 19 }
代码的继承和类的设计。
1 import java.util.Scanner; 2 3 public class Main{ 4 public static void main(String []args) { 5 Scanner in =new Scanner(System.in); 6 String name; 7 String key; 8 int balance; 9 10 name = in.next(); 11 key = in.next(); 12 BankBusiness account = new BankBusiness(name,key); 13 14 key = in.next(); 15 balance = in.nextInt(); 16 account.deposit(key,balance); 17 18 key = in.next(); 19 balance = in.nextInt(); 20 account.withdrawal(key,balance); 21 22 key = in.next(); 23 balance = in.nextInt(); 24 account.withdrawal(key,balance); 25 26 key = in.next(); 27 balance = in.nextInt(); 28 account.withdrawal(key,balance); 29 30 account.end(); 31 } 32 }
4.改进建议:
- 整体代码的可读性需加强有很多地方重复性太高。
2.对大作业2的7-2题,代码缩进不行,可读性差。
}
}
for(int n=0;n<time;n++){
output(arr[n],n+1);
}
}
}
}
}
3.大作业三的7-1题目,判断条件重复性太高,而且逻辑性不够清晰。
4.大作业三的7-2题目,整体运用的方法多,但是很多方法的内部也可以简化出别的方法。
5.大作业三的7-3题目,整体困难导致几种情况想不出来,而且整体对数学函数的运用和思路都需要大大提升。
5.总结:
本阶段三次题目集让我学到了基本的循环语句以及选择语言,尤其是更加熟练的运用字符串和字符串有关函数等等并让我更加熟练掌握了方法的运用和类的运用还有数学函数的运用等。对于类的运用和字符串以及数组等级基本类型的运用还需加强,尤其是一些基本语法。对整体的题目程序涉及方面还需加强,有很多地方可以简化运算和代码。代码的书写过程也需加强,很多题目的总体代码都存在重复性过高,可读性不强等问题。对方法的运用还需加强,熟练方法后可以增加代码可读性也能使代码更简单。
作业的测试点可以增加多一些提示,譬如有些模糊不清的输入判断如果增加一些提示将会更好。整体题目的难度,就是第一次第二次比较简单,突然第三次特别难,我觉得可以第三次也有一些难题,但是也可以增加两道简单题有循序渐进的过程。

浙公网安备 33010602011771号