Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A bowling match consists of ten frames. Each frame except for the tenth consists of one or two balls, or attempts to knock down the

A bowling match consists of ten frames. Each frame except for the tenth consists of one or two balls, or attempts to knock down the ten pins at the end of the alley. Doing so on the first ball of the frame is called a strike, and the second ball of the frame is not rolled. Knocking down all ten pins with both balls (having left some up with the first ball) is called a spare. If both attempts to knock down the pins leave some standing, the frame is called an open frame. A spare in the tenth frame gives the bowler one extra ball; a strike in the tenth gives him or her two extra balls. A bowling score is computed as follows. A strike counts as 10 points plus the sum of the next two balls. A spare counts as 10 points plus the next ball. Any other balls merely count as themselves, as do any bonus balls rolled as a result of a strike or a spare in the tenth frame. Suppose for example that the sequence of balls was 9 1 0 10 10 10 6 2 7 3 8 2 10 9 0 9 1 10 The score for the ten frames would be Frame score ----- ----- 1 10 2 30 3 56 4 74 5 82 6 100 7 120 8 139 9 148 10 168 Your goal in this project is to write a program to accept from standard input the scores for a sequence of balls and output the scores for the ten frames. The program should ask for input for each frame, asking for a second score if the first roll was not a strike. At most bowling alleys, the computerized scoring machines congratulate bowlers when they are doing a good job. When a bowler achieves consecutive strikes, output the following, according to the number of consecutive strikes: No. of consecutive strikes Output 2 Double! 3 Turkey! 4 Hambone! 5 Yahtzee! 6 Wild Turkey! This is a two week homework. For this homework, you will need to come up with an outline of goals for the project. By the end of the first week, your program should be able to do the following things: -Add up scores for the first nine frames (do NOT worry about the tenth frame yet) for both simple bowls (no strikes or spares) and frames that involve spares You will evaluate each other's code in class with several tests to see if the code does indeed successfully calculate simple games and games that involve spares. The complete checklist that you will be evaluated on is below: -The program runs -The program asks for scores one at a time (not for all of them at once) -The program asks for scores for 9 frames -Test the program for the following easy case: Every frame you bowl zero for both times. --Does the program output a final score? --Is the final score correct (i.e. 0)? --Does the program output the score at the end of every frame? -Next, test the program for the next most difficult case: Every frame you bowl a score of 1. -Is the final score correct (i.e. 18)? -Next, test the program to see if it successfully calculates spares. For the first two frames, the bowler bowls a 5 on the first throw and a 5 on the second throw. For frames 3-9, the bowler throws zeros. -Is the final score correct (i.e. 25)? -Lastly, test the program for a case in which you have many spares. For every frame, the bowler bowls a 5 on the first throw and a 5 on the second throw. -Is the final score correct (i.e. 135)? -The program does not crash (i.e. encounter Octave errors) for any of the test cases.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

Name the different categories of economic value.

Answered: 1 week ago

Question

=+What is your religion? Would you be able to perform the

Answered: 1 week ago