subject

Bowling involves 10 frames Each frame starts with 10 pins. The bowler has two throws to knock all 10 pins down. The total score is the sum of pins knocked down, with some special rules. For the first 9 frames
• If all 10 pins are knocked down on a frame's first throw (a strike"), that frame's score is the previous frame plus 10 plus the next two throws (No second throw is taken).
• If all 10 pins are knocked down after a frame's second throw (a "spare), that frame's score is the previous frame plus 10 plus the next throw.
In the 10th frame, if the bowler's first throw is a strike, or the first two throws yields a spare the bowler gets a third throw. The 10th frame's score is the previous frame's score plus the pins knocked down in the 10th frame's two or three throws
Given integers represents all throws for a game, output on one line each frame's score followed by a space (and end with a newline). Note that the number of throws may be as few as 11 (strikes in first 9 frames, and no strike/spare in 10th frame), or as many as 21 (2 throws in first 9 frames, then 3 in 10th).
For simplicity, the input will always have 21 integers, if the game ended with fewer than 21 throws, the remaining integeru will be O's and can be ignored.
Ex: A perfect game is one where every throw is a strike. The 21 input integers will be 10 10 10 10 10 10 10 10 10 10 10 10000000000.
The output will be: 30 60 90 120 150 180 210 240 270 300.
Hints
Ex: A perfect game is one where every throw is a strike. The 21 input integers will be 10 10 10 10 10 10 10 10 10 10 10 10000000000. The output will be 30 60 90 120 150 180 210 240 270 300.
Hints:
• A first for loop should just read in the 21 scores in the first array
• A second for loop should fill the second array's first 9 elements (first 9 frames)
• Additional code should compute the 10th frame, which is unique.
Main. java
1 import java. util. Scanner:
2
3 public class Main
4 public static void main(String[] args) {
5 Scanner schr- new Scanner(System. in);
6
7 /* Type your code here. /*
8 }
9 }
10

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 07:50, madim1275
Most shops require the technician to enter a starting and ending time on the repair order to track the actual time the vehicle was in the shop and closed out by the office. this time is referred to as _ time ? a. comeback b. ro c. cycle d. lead
Answers: 1
image
Computers and Technology, 24.06.2019 00:00, Amrinderkhattra
Visualizing a game of “tag” to remember the meaning of contagious
Answers: 3
image
Computers and Technology, 24.06.2019 03:00, 2020IRodriguez385
With editing, word automatically displays a paste options button near the pasted or moved text. a. cut-and-paste b. drag-and-drop c. inline d. copy-and-carry
Answers: 1
image
Computers and Technology, 24.06.2019 13:00, toshahoskins0098
What are some websites that you can read manga (ex: manga rock)
Answers: 1
You know the right answer?
Bowling involves 10 frames Each frame starts with 10 pins. The bowler has two throws to knock all 10...

Questions in other subjects:

Konu
Social Studies, 12.12.2020 17:10
Konu
Mathematics, 12.12.2020 17:10
Konu
Physics, 12.12.2020 17:10
Konu
Biology, 12.12.2020 17:10
Konu
Mathematics, 12.12.2020 17:10