结对编程——保龄球实验分析
提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档
保龄球实验分析
- 实验目的
- 实验过程
- 实验总结
一、实验目的
通过演练他人的《保龄球计分程序》实践,学习xp三大实践》
提示:以下是本篇文章正文内容,下面案例可供参考
二、实验过程
1.两人通过结对编程实践完成保龄球计分程序代码
代码如下(示例):
public int getBowlingScore(String bowlingCode) {if (bowlingCode==null ||bowlingCode.length()<=0)return 0;char[] c = bowlingCode.toCharArray();int i = 0;int X = 0;int Y = 0;int sum = 0;int current = 0;int num = 0;boolean flag = false;while (i < c.length) {current = 0;num = 0;if (c[i] == '|') {i++;while (i < c.length) {if (flag) {sum += NumofCurrentChar(c[i]) * 2;flag = false;} elsesum += NumofCurrentChar(c[i]);i++;}}while (i < c.length && c[i] != '|') {int temp = current;current = NumofCurrentChar(c[i]);if (temp > current) {num = temp;} else if (current> temp){num = current;current -= temp;}if (X > 0) {if (flag) {sum += current * 2;flag = false;} elsesum += current;X--;}if (Y > 0) {sum += current;Y--;}if (c[i] == 'X') {if (X == 1) {flag = true;}X = 2;} else if (c[i] == '/') {Y = 1;}i++;}sum += num;i++;}return sum;}private int NumofCurrentChar(char c) {int current;if (c == '/')current = 10;else if (c == '-')current = 0;else if (c == 'X')current = 10;elsecurrent = c - '0';return current;}
代码如下(示例):
public int getBowlingScore1(String bowlingCode) {char[] chars = bowlingCode.toCharArray();int i = 0;int sum = 0;int[] socere = new int[22];int x = 0;int current = 0;while (i < chars.length) {current = -10;if (chars[i] == '|') {while (i < chars.length - 1 && x < socere.length) {i++;socere[x] = NumofCurrentChar(chars[i]);if (socere[x] == -2) {socere[x] = 10;}x++;}}while (i < chars.length && chars[i] != '|') {int temp = current;current = NumofCurrentChar(chars[i]);if (current >= 0 && temp > current)current = temp;i++;if (x < socere.length)if (current == -2) {socere[x++] = 10;socere[x++] = current;} else {socere[x++] = current;}}i++;}System.out.println(Arrays.toString(socere));int[] socere2 = new int[10];int j = socere2.length - 1;while (j >= 0) {if (socere[2 * j + 1] == -2) {if (j == 9)socere2[j] = socere[2 * j + 2] + socere[2 * j + 3] + 10;else if (socere[2 * (1 + j) ] == 10 ) {socere2[j] = 10+ socere[2 * (2 + j) ]+10;}else if (socere[2*(j+1)] <10){socere2[j] = 10 +socere[2*(j+1)+1];}socere[2 * j + 1] = 10;} else if (socere[2 * j + 1] == -1) {socere2[j] = socere[j * 2 + 1 + 1] + 10;socere[2 * j + 1] = 10;} elsesocere2[j] = socere[(j + 1) * 2 - 1];j--;}j = 0;while (j < socere2.length) {sum += socere2[j++];}System.out.println(Arrays.toString(socere2));return sum;}/*** 返回当前位置的数值** @param c* @return*/private int NumofCurrentChar(char c) {int current;if (c == '/')current = -1;else if (c == '-')current = 0;else if (c == 'X')current = -2;elsecurrent = c - '0';return current;}
实验总结
这门课程的学习,对课程安排,感觉很紧凑,几乎不遗漏任何的知识点。理论总在实验和机试前,这样有利教学,感觉教师讲课的思路很清晰,运用课件的形式讲课,很有概括性,重点一针见血,易理解理解,感觉不到课堂的枯燥,实验前,教师总会给足够的时间给我们预习。分成小组的形式,让我们构成合作的团体,实验中不仅仅让我获得知识,更锻炼了我们同学之间的合作。实验中学会了测试、IP地址规划与管理等等。即使操作上,我们学会了开通博客、等等。实验后的实验报告让我们有了总结回顾的效果。计算机网络是计算机技术和软件技术相互结合、相互渗透而构。
————————————————
结对编程——保龄球实验分析相关推荐
- 结对编程--------四则运算 实验总结2
结对编程----------四则运算 实验总结2 结对对象 20172301 郭恺 20172328 李馨雨 过程截图 这个是我们编写的main,叫ArithmeticTest1主要用于生成随机等级的 ...
- 20172304 结对编程--四则运算实验总结
20172304 结对编程--四则运算 结对对象 20172301 郭恺 20172328 李馨雨 需求分析 以结对小组形式编写代码,实现以下功能: 1.自动生成题目 可独立使用(能实现自己编写测试类 ...
- 结对编程队友代码分析
这次结对编程的队友是可熊,感谢可熊不嫌弃我这个鶸,,和我组队 通过分析可熊的代码,深刻体会到了自己代码的不规范以及代码可延展性的缺失 比如using namespace std; ,这一行代码虽然自己 ...
- 中小学数学卷子自动生成程序--对结对编程队友的分析
中小学数学卷子自动生成程序大致需求: 用户登录账号后系统根据类型生成小学.初中或者高中的卷子,在登陆状态下,可以切换为不同类型的卷子,也可注销登录. 该同学用java完成了中小学数学卷子自动生成程序, ...
- 北航2022软件工程第三次作业——结对编程(最长英语单词链)
软件工程第三次结对编程作业 项目 内容 这个作业属于哪个课程 北京航空航天大学2022春季软件工程(罗杰 任健) 这个作业的要求在哪里 结对编程项目-最长英语单词链 我在这个课程的目标是 学习软件工程 ...
- 结对编程前对队友程序的分析与对比总结
目录 1. 项目需求 1.1 项目名称 1.2 用户 1.3 功能 2. 对队友程序的分析 2.1 主要流程分析 2.2 主要函数分析 2.3 优点 2.4 缺点 3. 与自己的程序比较 4. 个人项 ...
- 2017-2018-2 1723《程序设计与数据结构》第八周作业 实验二 第一周结对编程 总结...
作业地址 第八周作业:https://edu.cnblogs.com/campus/besti/CS-IMIS-1723/homework/1847 (作业界面已评分,可随时查看,如果对自己的评分有意 ...
- 第二次软件综合实验专题作业——结对编程 1759103 李思佳 、 1759107 陶彦婷
结对编程 本次作业由 1759103 李思佳 与 1759107 陶彦婷 共同完成 经过一番讨论,我们决定用JAVA来完成这次作业.选择JAVA的原因大致可以分为以下三点:(1)我们学过的语言一共有三 ...
- “结对编程” 实验心得
实验内容: 1. 联系结对编程,体验敏捷开发中的两人合作: 2. 两人一组,自由组合: 3. 使用一台计算机,共同编码,完成实验要求: 4. 在工作期间,两人的 ...
最新文章
- element ui需要引入样式吗_ElementUI 修改默认样式的几种办法
- Linux 设置core dump
- 分布式理论:CAP是三选二吗?
- com.android.dex.DexIndexOverflowException: Cannot merge new index 66299 into a non-jumbo instruction
- python多线程详解_python基础:python多线程详解
- php 谷歌语音,php 语音参考
- matlab信号分割与比对,matlab测量计算信号的相似度
- WebView内存泄露的解决方案
- oppo 手机侧滑快捷菜单_关于oppo手机菜单键调出的方法,原来是这样的
- libuv tcp client
- 吴恩达《机器学习》第七章:正则化
- Alarm:IT界朋友请珍惜你的身体[转贴]
- Qt VS中设置.ui文件的生成的.h的目录
- javaweb项目的文件结构
- 金融知识图谱有什么?
- windows 10(64位) 本地模式安装Hadoop和Hbase
- 终端安全管理之殇:安全管控能力与用户体验
- Activity工作流(2)-入门安装运行第一个例子
- 微信小程序相册-笔记1
- 我的创业你也可以复制:股权结构中常见的问题