Bowling involves 10 frames. Each frame starts with 10 pins. The bowler has two throws to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 integers will be 0'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 10 0 0 0 0 00000. 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. LAB ACTIVITY 5:20.1: PRACTICE: Arrays*** Bowling score 1 import java.util.Scanner; 3 public class Main ( 10 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); /Type your code here. / Main.java 0/4 Load default template.... Traversing an array to find the max (or min) is common. Given an array of integers, output the maximum integer found in the array. If the input is 438 2 6, the output is 8 Hints: • Declare a variable named maxitem to hold the max value seen so far. Update that value if you ever see a larger value. • Initialize that variable to any element's value, NOT to 0. LAB ACTIVITY 1 import java.util.Scanner; 2 3 public class Main ( 7 5.21.1 PRACTICE Arrays*: Find max 9 10 11 12 13 14 15 16 17 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int numitems; int curritem; int i; // Get items numItems scnr.nextInt(); int[] listItems new int[numitems]; for (i = 0; i<numitems; ++i) { currItem= scnr.nextInt (); listItems [1] curritem; Develop mode Submit mode Run program Enter program input (optional) If your code requires input values, provide them here. Program output displayed here Main.java Input (from above) Run your program as often as you'd like, before submitting for grading. Below, type any needed Input values in the first box, then click Run program and observe the program's output in the second box. Main.java (Your program) Load default template.... 0/5 Output (shown below) Coding trail of your work What is this? History of your effort will appear here once you begin working on this zyLab. 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 integers will be 0'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 10 0 0 0 0 00000. 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. LAB ACTIVITY 5:20.1: PRACTICE: Arrays*** Bowling score 1 import java.util.Scanner; 3 public class Main ( 10 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); /Type your code here. / Main.java 0/4 Load default template.... Traversing an array to find the max (or min) is common. Given an array of integers, output the maximum integer found in the array. If the input is 438 2 6, the output is 8 Hints: • Declare a variable named maxitem to hold the max value seen so far. Update that value if you ever see a larger value. • Initialize that variable to any element's value, NOT to 0. LAB ACTIVITY 1 import java.util.Scanner; 2 3 public class Main ( 7 5.21.1 PRACTICE Arrays*: Find max 9 10 11 12 13 14 15 16 17 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int numitems; int curritem; int i; // Get items numItems scnr.nextInt(); int[] listItems new int[numitems]; for (i = 0; i<numitems; ++i) { currItem= scnr.nextInt (); listItems [1] curritem; Develop mode Submit mode Run program Enter program input (optional) If your code requires input values, provide them here. Program output displayed here Main.java Input (from above) Run your program as often as you'd like, before submitting for grading. Below, type any needed Input values in the first box, then click Run program and observe the program's output in the second box. Main.java (Your program) Load default template.... 0/5 Output (shown below) Coding trail of your work What is this? History of your effort will appear here once you begin working on this zyLab.
Expert Answer:
Related Book For
Cost management a strategic approach
ISBN: 978-0073526942
5th edition
Authors: Edward J. Blocher, David E. Stout, Gary Cokins
Posted Date:
Students also viewed these programming questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
The Crazy Eddie fraud may appear smaller and gentler than the massive billion-dollar frauds exposed in recent times, such as Bernie Madoffs Ponzi scheme, frauds in the subprime mortgage market, the...
-
Which of the following questions involve microeconomics, and which involve macroeconomics? In each case, explain your answer. a. Why did consumers switch to smaller cars in 2008? b. Why did overall...
-
Suppose you are reading an article at psychcentral.com and the following text appears in a pop-up window: What tactic is the company using to increase the response rate for its survey? Market...
-
In Problems 1526, find the domain of each rational function. Q(x) = -x(1 - x) 3x + 5x - 2
-
What are the purposes of the opinion paragraph in the auditor's report? Identify the most important informa tion included in the opinion paragraph. What is meant by the term "appropriate disclosed...
-
The school board is trying to evaluate a new math program introduced to second-graders in five elementary schools across the county this year. A sample of the student scores on standardized math...
-
Refer to the Auditing Standards Exhibit inside the front cover of this textbook. Identify the IAASB ISA that provides guidance on management assertions. List the management assertions identified in...
-
The management of Hartman Company is trying to determine the amount of each of two products to produce over the coming planning period. The following information concerns labor availability, labor...
-
... Ap Saved Hard Hat Company is in the process of purchasing several large pieces of equipment from Machine Corporation. Several financing alternatives have been offered by Machine: 1. Pay...
-
A successful marketing and strategy plan hinges on a deep understanding of your business, goals, target audience, and market conditions. Discuss?
-
E15.13 (LO 3) (Stock Split and Stock Dividend) The common stock of Alexander Hamilton Inc. is currently selling at $120 per share. The directors wish to reduce the share price and increase share vol-...
-
Here are data regarding the current month: Sales revenue $240,000 Overapplied manufacturing overhead $9,000 Cost of goods manufactured $180,000 Finished goods inventory, beginning $10,000 Finished...
-
Write marketing sales letter to convince a person who is not at all willing to purchase our product, like an insurance plan from Green Shield Canada. Please write it briefly in three pages, including...
-
Let f(x)=9(2) 1. Evaluate f(3) without using a calculator. Provide your answer below: f(3)=
-
FASB Statement 164 Not-for-Profit Entities: Mergers and Acquisitions requires mergers and acquisitions to be recorded using the carryover method
-
Pedro Bourbone is the founder and owner of a highly successful small business and, over the past several years, has accumulated a significant amount of personal wealth. His portfolio of stocks and...
-
Stackhouse Computing produces high performance desktop computers. Labor cost data shows that the company spent $1,000,000 for 5,000 computers produced, and each computer requires two technician hours...
-
What are some important behavioral and implementation issues in strategic performance measurement? How does the management accountant deal with these issues?
-
How does the analysis of overhead variances differ for companies using a traditional cost system versus an ABC system?
-
Online, find a residential tenancy lease. Is it important for a lease to be in writing? Who probably drafted the lease, a landlord or a tenant? How can you tell? Should any other provisions be...
-
9. ROLE REVERSAL Write one multiple-choice question with two noncompete clauses, one of which is valid and the other void.
-
Question: Sun operates an upscale sandwich shop in New Jersey, in a storefront that she leases from Ricky for $18,000 per month. The lease, which expires soon, allows Sun to renew for five years, at...
Study smarter with the SolutionInn App