Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

**This needs to be in MATLAB format please** A bowling match consists of ten frames. Each frame except for the tenth consists of one or

**This needs to be in MATLAB format please**

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 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!

Your goals for this week should be as follows:

-Change the code to include the special tenth frame

-Add the capability to score strikes

-Add bonuses

Test your program for the example set of scores (above), as well as this professional bowler's scores:

10

10

10

10

10

9 1

10

8 1

9 1

10 10 8

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

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions

Question

Determine the contribution margin at the break even point in $$

Answered: 1 week ago