zoukankan      html  css  js  c++  java
  • 个人项目作业

    个人项目作业

    1.Github项目地址

    https://github.com/smart6666/hong-SE/tree/master/hong-SE

    2.PSP表格

    PSP2.1

    Personal Software Process Stages

    预估耗时(分钟)

    实际耗时(分钟)

    Planning

    计划

     20

     30

    · Estimate

    · 估计这个任务需要多少时间

     20

     30

    Development

    开发

     100

    175

    · Analysis

    · 需求分析 (包括学习新技术)

     30

     40

    · Design Spec

    · 生成设计文档

     0

     0

    · Design Review

    · 设计复审 (和同事审核设计文档)

     0

     0

    · Coding Standard

    · 代码规范 (为目前的开发制定合适的规范)

     10

     10

    · Design

    · 具体设计

     20

     60

    · Coding

    · 具体编码

     20

     15

    · Code Review

    · 代码复审

     10

     10

    · Test

    · 测试(自我测试,修改代码,提交修改)

     10

     30

    Reporting

    报告

     35

     40

    · Test Report

    · 测试报告

     15

     15

    · Size Measurement

    · 计算工作量

     10

     10

    · Postmortem & Process Improvement Plan

    · 事后总结, 并提出过程改进计划

     10

     15

    合计

     155

     245

    3.解题思路

    1. 看到这个题目首先确定使用自己比较擅长的语言java。
    2. 由于以前没有涉及过项目,所以先上网查找资料学习做需求分析(https://www.cnblogs.com/ningjing-zhiyuan/p/8563562.html)
    3. 根据需求设计类,需要有一个读取文件的工具类,一个可以调用工具类然后输出结果的类及测试类。

    4.设计实现过程

    5.代码说明

    public static String read(String fileName) {
    		StringBuilder sb = new StringBuilder();
    		try {
    			BufferedReader in= new BufferedReader(new FileReader(
    					new File(fileName).getAbsoluteFile()));
    			try {
    				String s;
    				while((s = in.readLine()) != null) {
    					sb.append(s);
    					sb.append("
    ");
    				}
    			} finally {
    				in.close();
    			}
    		} catch(IOException e) {
    			throw new RuntimeException(e);
    		}
    		return sb.toString();
    	}
    

      

      private static String getFilePathFromFileChooser() {
            JFileChooser fileChooser = new JFileChooser();
            fileChooser.setDialogTitle("请选择文本文件");
            fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);    //只支持选取文件
            fileChooser.setMultiSelectionEnabled(false);    //只支持选取单文件
            fileChooser.showDialog(new JLabel(), "选择");
            File selectedFile = fileChooser.getSelectedFile();
            if (selectedFile == null) {
                return null;
            }
            System.out.println(selectedFile.getAbsolutePath());
            return selectedFile.getAbsolutePath();
        }
    WordCounter wordCounter = new WordCounter(fileName);
                for (String arg : parameters) {
                    //用户选项为“-c”
                    if (arg.equals("-c")) {
                        int charNum = wordCounter.charNumCounter();
                        if (charNum >= 0)
                            System.out.println("文件字符数为:" + charNum);
                        else
                            System.out.println("字符数计算出错");
                    }
                    //用户选项为“-w”
                    if (arg.equals("-w")) {
                        int wordNum = wordCounter.wordNumCounter();
                        if (wordNum >= 0)
                            System.out.println("文件单词数为:" + wordNum);
                        else
                            System.out.println("单词计算出错");
                    }
                    //用户选项为“-l”
                    if (arg.equals("-l")) {
                        int lineNum = wordCounter.lineNumCounter();
                        if (lineNum >= 0)
                            System.out.println("文件行数为:" + lineNum);
                        else
                            System.out.println("行数计算错误");
                    }
                }

    6.测试运行

    7.项目小结

    这是一个看起来不难,实际操作却很繁杂的人,我很久没打码了,老师突然要求做项目真的很措手不及,而且我还等到快交作业的时候才做,时间实在仓促,只做了基本功能,和一个选择文件视图。感觉很多时间都在犹豫做什么,思路不清晰,有点混乱。

  • 相关阅读:
    windows常用快捷键
    【Linux】查看系统位数
    【Centos】yum 安装mariaDB
    【Centos7 GRUB】修改开机等待时间
    Shell脚本编写规范
    【Shell Basic】source . 与 bash sh 的区别
    linux防火墙之 ufw
    【HotSpot】jps命令行详解
    【Ubuntu 16】网络配置文件
    【刷题】BZOJ 2179 FFT快速傅立叶
  • 原文地址:https://www.cnblogs.com/hong-chang/p/12496994.html
Copyright © 2011-2022 走看看