Coder Social home page Coder Social logo

scoresheet-cli's Introduction

练习 - 学生成绩单-命令行版

需求描述

我们现在做一个命令行应用。当程序启动的时候,我们会看到一个命令行的主界面:

1. 添加学生
2. 生成成绩单
3. 退出
请输入你的选择(1~3):

如果我们输入1,那么界面就会变成:

请输入学生信息(格式:姓名, 学号, 学科: 成绩, ...),按回车提交:

如果输入格式不正确,就返回:

请按正确的格式输入(格式:姓名, 学号, 学科: 成绩, ...):

如果输入格式正确就会返回

学生xxx的成绩被添加

然后打印

1. 添加学生
2. 生成成绩单
3. 退出
请输入你的选择(1~3):

等于回到了主界面。 如果我们在主界面输入了2,那么界面就会变成:

请输入要打印的学生的学号(格式: 学号, 学号,...),按回车提交:

如果我们输入的不正确,就会打印:

请按正确的格式输入要打印的学生的学号(格式: 学号, 学号,...),按回车提交:

如果输入的格式正确,则会打印成绩单并回到主界面。

成绩单
姓名|数学|语文|英语|编程|平均分|总分 
========================
张三|75|95|80|80|82.5|330
李四|85|80|70|90|81.25|325
========================
全班总分平均数:xxx
全班总分中位数:xxx

如果我们输入的学号不存在,该学号在计算时就会被忽略。

作业要求

  1. 画 Task 图;
  2. 编写测试代码;
  3. 使用同步 IO。

如何使用

首先初次下载完需要安装依赖:

  npm install

然后才能执行测试:

  npm test

可以通过测试来检测本地代码是否完成作业要求,测试通过即可提交到github,把git库地址填到答题页面,并提交表单。

参考资料

  1. npm 下载安装
  2. node 下载安装
  3. jasmine用法
  4. git用法1
  5. git用法2
  6. git简易指南
  7. github用法
  8. 像机器一样思考

答题流程

  • 请用户仔细阅读题目要求和题目描述

  • 在命令行中使用以下命令在用户本地任意目录下clone此题目库

git clone repo_of_this_template

NOTE:如果提示git命令未找到请先阅读参考资料

  • 用任意编辑器打开clone下来的文件夹,内部会存在两个文件夹
spec  //测试文件夹
src   //源文件

请在src文件下的main.js文件内实现main函数

  • 完成函数后,使用以下命令设置github远程仓库地址 (my_url代表你自己的新的github地址)
 git remote set-url origin my_url
  • 请使用git提交(commit)并上传(push),之后将此github仓库地址(用户自建的) eg:(https://github.com/username/repo) 填入到提交地址一栏
  • 获取分支
  • 提交
  • 等待结果

如何本地运行

首先初次下载完需要安装依赖:

  npm install

然后才能执行测试:

  npm test

可以通过测试来检测本地代码是否完成作业要求,测试通过即可提交到github,把git库地址填到答题页面,并提交表单。

scoresheet-cli's People

Contributors

313183373 avatar laobingfung avatar seabornlee avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.