Java Programming (TEN)-----The bowling integral program says that the practice array is really just a math problem for the pit daddy ...

Source: Internet
Author: User
Tags rounds

To kneel and beg for a simple way ......... .....

Rules.

1. This Council once 10 points plus 2 pitches in the back

2 This council complements 10 points plus 1 pitches in the back

3 this council 2 times less than 10 points that's all.

10th round in any case must first cast 2 times 2 times more than 10 points to increase the investment 1 times

Out of 300

Package com.lovo;/** * Bowling Credit Program * @author Abe */import Java.util.scanner;public class Bowling {public static void main (STR Ing[] args) {Scanner sc = new Scanner (system.in); int[][] scores = new Int[11][4];for (int i = 0; i < scores.length; i++ {//Loop 11-round if (I < scores.length-1) {//10 rounds before System.out.printf ("Please enter the number of rounds%d, 1th times down:", i + 1); Scores[i][0] = Sc.nextint () ; if (Scores[i][0] < | | i = = 9) {//The first 9 rounds are not 10, then the second score is recorded, and the 10th round is recorded 2 times in any case System.out.printf ("Please enter the number%d rounds, 2nd times down:", i + 1); score S[I][1] = Sc.nextint ();}} else if (Scores[i-1][0] + scores[i-1][1] >= 10) {//10th round 10 points or more 11 round score System.out.printf ("Please enter the number of rounds%d,%d times down:", I, 3); Scores[i][0] = scores[i][2] = Sc.nextint ();}} for (int i = 0; i < scores.length-1; i++) {//First 11 rounds if (scores[i][0] = = && I! = 9) {if (scores[i + 1][0] = = 10 && I < 8) {//First 8 rounds, 10 minutes at a time after 2 pitching score scores[i][2] = scores[i][0] + scores[i + 1][0]+ scores[i + 2][0];} else if (scores[i + 1][0]! = Ten | | i = = 8) {//9th round 10 minutes 10th Round 2 times score scores[i][2] = scores[i][0] + scores[i + 1][0] + scores[i + 1][1];}} Else{if (Scores[i][0] + scores[i][1] = = && I < 9) {//First 9 round 10 plus the first time of the lower part scores[i][2] = Scores[i][0] + scores I [1] + scores[i + 1][0];}  ELSE{SCORES[I][2] = scores[i][0] + SCORES[I][1];//2 times less than 10 minutes to remember so many}}}//to accumulate integral scores[0][3] = scores[0][2];for (int i = 1; i < scores.length;i++) {scores[i][3]=scores[i][2] + scores[i-1][3];} Print all for (int i = 0; i < Scores.length, i++) {for (int j = 0; J < Scores[i].length; J + +) {System.out.print (scores[i][ J] + "\ t");} System.out.println ("\ t" + (i + 1) + "round \ n");}}


Java Programming (TEN)-----The bowling integral program says that the practice array is really just a math problem for the pit daddy ...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.