花旗实习培训内容记录

第一周

1. Bowling Game 计分程序
2. TDD Bowling Game 接口向
3. Bowling Game 接口向编程、递归及Junit

题目描述

package traing.bowling.impl;
/*
 * 
 * if--else 可改三元表达式
 */


import java.util.*;

public class Bowling{
	public static int calculate(int[][] turns) {   //calculate scores
		
		if(!(isTurnValid(turns))&&!(isGameValid(turns))) { //when it is valid data
		
			int score=0;
			for(int i=0;i<10;i++) {
	
					if(!isStrike(turns[i])&&isMiss(turns[i])) { //when it is Miss(Against not found pointer)
						score=score+turns[i][0]+turns[i][1];
					}else if(!isStrike(turns[i])&&isSpare(turns[i])) {   //when it is Spare
						score=score+10+turns[i+1][0];
					}else if(isStrike(turns[i])&&!isStrike(turns[i+1])) {  //when it is Strike and the next is not Strike
						score=score+10+turns[i+1][0]+turns[i+1][1];
					}else if(isStrike(turns[i])&&isStrike(turns[i+1])) {   //when it is Strike and the next is Strike
						score=score+20+turns[i+2][0];
					}
	
			}
			return score;
		}else {                                    //when it is invalid data
			System.out.println("invalid");
			return -1;
		}
		
	}
	
	private static boolean isStrike(int[] turn) {   //isStrike
		if(turn[0]==10) {
			return true;
		}
		return false;
	}
	
	private static boolean isSpare(int[] turn) {    //isSpare
		if(turn[0]+turn[1]==10) {
			return true;
		}
		return false;
	}
	
	private static boolean isMiss(int[] turn) {     //isMiss
		if(turn[0]+turn[1]<10) {
			return true;
		}
		return false;
	}
	
	private static boolean isTurnValid(int[][] turns) {  //invalid turns
		int turns_row=turns.length;
		if((turns_row>12)||(turns_row<10)) {    //the length of turns is not lower than 10 or higher than 12
			
			return true;
		}
		return false;
	}
	
	private static boolean isGameValid(int[][] turns) {  //invalid data
		int turns_row=turns.length;       //the length of turns
		for(int i=0;i<turns_row;i++) {  
			int turns_line=turns[i].length;
			if((turns_line<=2)&&(turns_line>0)) {   //it is only twice for one round
				for(int j=0;j<turns_line;j++) {
					if((turns[i][j]<0)||(turns[i][j]>10)) {  //the score for once is not lower than 0 or higher than 10
						   
						return true;
					}
				}
				if(turns_line==1) {
					if((turns[i][0]!=10)&&(i!=turns_row-1)) {//only one data of a round for two conditions:
						                                                //10 or the last time 
						return true;
					}
				}
				
				if(turns_line==2) {       //when the sum of two data for one round is higher than 10
					if(turns[i][0]+turns[i][1]>10) {
						  
						return true;
					}
				}
			}else {                   //when more than twice for one round
				
				return true;
			}
		}
		
		//the conditions for the tenth round
		if((isStrike(turns[9]))&&(turns_row==10)) { //the ten round is Strike 
			                                         //and the length of turns is mistake
			   
			return true;
		}
		if((isStrike(turns[9]))&&(isStrike(turns[10]))&&(turns_row!=12)) {//the tenth round is Strike 
			                                                           //and the eleventh round is Strike 
			                                                               //and the length of turns is mistake
			
			return true;
		}
		if((isStrike(turns[9]))&&(!isStrike(turns[9]))&&(turns_row!=11)) {//the tenth round is Strike 
                                                                       //and the eleventh round is not Strike 
                                                                         //and the length of turns is mistake
			
			return true;
		}
		if((!isStrike(turns[9]))&&(isSpare(turns[9]))&&(turns_row!=11)) {//the tenth round is Spare 
                                                                //and the length of turns is mistake
			  
			return true;
		}
		if((!isStrike(turns[9]))&&(isMiss(turns[9]))&&(turns_row!=10)) {//the tenth round is Miss  
                                                                //and the length of turns is mistake
			   
			return true;
		}
		return false;
	}
	
	public static void main(String[] args) {
		
		//test
		int[][] turns1= {{10},{10},{10},{10},{10},{10},{10},{10},{10},{10},{10},{10}};
		int[][] turns2= {{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}};
		int[][] turns3= {{10},{10},{10},{10},{10},{10},{10},{10},{10},{10},{3,7}};
		int[][] turns4= {{10},{10},{10},{10},{10},{10},{10},{10},{10},{1,9},{10}};
		int[][] turns5= {{5,5},{5,5},{5,5},{5,5},{5,5},{5,5},{5,5},{5,5},{5,5},{5,5},{5}};
		int[][] turns6= {{-1,-4},{11,-1}};
		int[][] turns7= {{10},{10},{10},{10},{10},{10},{10},{10},{10},{10},{3,8}};
		int[][] turns8= {{10},{10},{10},{10},{10},{10},{10},{10},{10},{10},{10},{7}};
		
		System.out.println(calculate(turns1));
		System.out.println(calculate(turns2));
		System.out.println(calculate(turns3));
		System.out.println(calculate(turns4));
		System.out.println(calculate(turns5));
		System.out.println(calculate(turns6));
		System.out.println(calculate(turns7));
		System.out.println(calculate(turns8));
	}
}

https://github.com/carolyyyy/bowling
https://github.com/carolyyyy/adv-bowling

第二周

IBM Robocode

第三周

Trading System Web Demo
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
以上为题目描述,总结下来就是做一个基于WEB交易系统trader可以创建trade,user也可以创建trade,若后台判定是同一条trade,则会自动匹配,trade涉及更删改查操作。trader可更改trade价格以匹配用户,但是有一定范围,若超出范围,后台会自动判定reject,否则为accept

前端我们采用的是vue,后台是java。由于时间有限,只是完成了项目基础功能,仅供学习使用。
https://github.com/carolyyyy/Trading-System

1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 2、项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 5、资源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。 1、资源项目源码均已通过严格测试验证,保证能够正常运行; 、2项目问题、技术讨论,可以给博主私信或留言,博主看到后会第一时间与您进行沟通; 3、本项目比较适合计算机领域相关的毕业设计课题、课程作业等使用,尤其对于人工智能、计算机科学与技术等相关专业,更为适合; 4、下载使用后,可先查看README.md或论文文件(如有),本项目仅用作交流学习参考,请切勿用于商业用途。 、资5源来自互联网采集,如有侵权,私聊博主删除。 6、可私信博主看论文后选择购买源代码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值