第二周作业

这个作业属于哪个课程 https://edu.cnblogs.com/campus/zswxy/computer-science-class3-2018/
这个作业要求在哪里 https://edu.cnblogs.com/campus/zswxy/computer-science-class3-2018/homework/11879
这个作业的目标 学习git用法并进行编程
学号 20188460

gitee地址

https://gitee.com/SkrDeception/project-java

PSP表格

PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟)
Planning 计划 50 15
• Estimate • 估计这个任务需要多少时间 1300 1600
Development 开发 200 100
• Analysis • 需求分析 (包括学习新技术) 50 100
• Design Spec • 生成设计文档 75 55
• Design Review • 设计复审 20 10
• Coding Standard • 代码规范 (为目前的开发制定合适的规范) 80 40
• Design • 具体设计 40 30
• Coding • 具体编码 100 50
• Code Review • 代码复审 200 150
• Test • 测试(自我测试,修改代码,提交修改 70 100
Reporting 报告 30 60
• Test Repor • 测试报告 20 10
• Size Measurement • 计算工作量 70 40
• Postmortem & Process Improvement Plan • 事后总结, 并提出过程改进计划 20 10
合计 2325 2370

代码块

处理文本大小写

do {
    	if(i!=-1) {
			tempStream.write(i);
		}    	
    	i = myBufferedReader.read();
    	if(i >= 65 && i <= 90) {
    		i += 32;
    	}
    	}
		while(i != -1);

单词处理

public static int CountWordNum(String line, List<String> lists) {
        int wordcount = 0;
        String[] wordsArr1 = line.split("[^a-zA-Z0-9]");  //切割筛选单词

        for (String newword : wordsArr1) {  
            if(newword.length() != 0) {               	
                if((newword.length() >= 4) && (Character.isLetter(newword.charAt(0))
                    && Character.isLetter(newword.charAt(1)) && Character.isLetter(newword.charAt(2))
                    && Character.isLetter(newword.charAt(3)))) {               		
                    wordcount++;
                    lists.add(newword);  
                }
            }  
        }

        return wordcount;
    }

词频统计

for (String li : lists) {  //单词出现个数统计
            if(wordsCount.get(li) != null) { 
                wordsCount.put(li,wordsCount.get(li) + 1);  
            }
            else {  
                wordsCount.put(li,1);  
            }  
  
        }  

输出文本

Print p = new Print(args[1]);
p.SortMap(wordsCount,wordline,wordcount,characterscount+wordline);  //排序并输出
单元测试
public void testCharacter() {
        int result = Lib.CountEachLineCharacter(s);
        assertTrue(result == length);
    }
public void testWordNum() {
        int result = Lib.CountWordNum(s,list);
        assertTrue(result == num);
    }
异常处理说明

命令行参数错误

catch(ArrayIndexOutOfBoundsException ee) {
    System.out.println("Error");
}

输入文件不存在

catch(FileSystemAlreadyExistsException f) {
    System.out.println("Not find this file");
}

其他错误

catch(Exception e) {
    System.out.println(e);
}

连接仓库

运行截图

心得体会

充分感受到自己有很多的不足,一开始这个题目毫无头绪,经过了小组内组员的帮忙才能不容易的整出点成果来,我累了,大佬们也累了,需要再接再厉,争取赶上组员们的步伐。

posted on 2021-04-02 02:28  夕鹿生  阅读(49)  评论(0编辑  收藏  举报