java实现保龄球规则

本文详细介绍了如何使用Java编程语言实现保龄球的计分规则,包括第10次的特殊计算和补分机制,虽然方法相对繁琐,但确保了计分过程的直观易懂。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

                                       

import java.util.Arrays;
import java.util.Scanner;


public class test5 {
	
	public static int flag[] =new int[10];//判断状态: 0: 2次没中10;, 1 :补中 ;2:第一次全中
	public static int[] finScore =new int[10];//每轮分数
	public static int[][] eachScore = new int[10][3];//每次分数,最后一次若有3次另外算
	/*
	 * 记录每轮的得分
	 * */
	public static void getScore(int firstSore,int secondSore,int count ){
		if(firstSore!=10){
			eachScore[count][0] = firstSore;
			if(10-firstSore>secondSore){
				flag[count]=0;
				eachScore[count][1]=secondSore;
				finScore[count] =firstSore+secondSore;
				System.out.println("本轮为"+(count+1)+"轮,2次都没全中哦~"+"本轮成绩为"+finScore[count]);
			}else if(10-firstSore==secondSore){
				fl
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值