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

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
Requirement types discussed during software development include functional and color scheme nonfunctional and code style constraint and nonfunctional fashionable and functional.
Answers: 2
question
Computers and Technology, 22.06.2019 22:40
In this lab, you complete a python program that calculates an employee's annual bonus. input is an employee's first name, last name, salary, and numeric performance rating. if the rating is 1, 2, or 3, the bonus rate used is .25, .15, or .1 respectively. if the rating is 4 or higher, the rate is 0. the employee bonus is calculated by multiplying the bonus rate by the annual salary.
Answers: 1
question
Computers and Technology, 23.06.2019 15:10
What role did women fill during world war ii?
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
Now you’re on your own. include a short summary of this section with plots in your lab report. write a matlab script file to do steps (a) through (d) below. include a listing of the script file with your report. 1 the soundsc(xx,fs) function requires two arguments: the first one (xx) contains the vector of data to be played, the second argument (fs) is the sampling rate for playing the samples. in addition, soundsc(xx,fs) does automatic scaling and then calls sound(xx,fs) to actually play the signal. mcclellan, schafer, and yoder, dsp first, 2e, isbn 0-13-065562-7. prentice hall, upper saddle river, nj 07458. c 2015 pearson education, inc. 4 mcclellan, schafer and yoder, signal processing first. prentice hall, upper saddle river, new jersey, 2003. c 2003 prentice hall. (a) generate a time vector (tt) to cover a range of t that will exhibit approximately two cycles of the 4000 hz sinusoids defined in the next part, part (b). use a definition for tt similar to part 2.2(d). if we use t to denote the period of the sinusoids, define the starting time of the vector tt to be equal to t , and the ending time as ct . then the two cycles will include t d 0. finally, make sure that you have at least 25 samples per period of the sinusoidal wave. in other words, when you use the colon operator to define the time vector, make the increment small enough to generate 25 samples per period. (b) generate two 4000 hz sinusoids with arbitrary amplitude and time-shift. x1.t / d a1 cos.2
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
question
Mathematics, 24.04.2021 02:00
question
Mathematics, 24.04.2021 02:00
question
Mathematics, 24.04.2021 02:00
question
Mathematics, 24.04.2021 02:00
question
English, 24.04.2021 02:00
question
English, 24.04.2021 02:00
Questions on the website: 13722367