UMBC CS 201, Spring 00
UMBC CMSC 201 Spring '00 CSEE | 201 | 201 S'00 | lectures | news | help

CMSC 201
Programming Project Three
Bowling Scores

Due Date: Before Midnight, 4/9/00

The Objective

The objective of this assignment is to give you practice with arrays, passing arrays to functions, and using seperate compilation.

The Background

In 10-pin bowling, a player will bowl 10 frames to complete a game. At the beginning of each frame the player is given 10 pins to attempt to knock down. S/he may roll two balls in order to accomplish this goal. If the player knocks down all 10 pins with the first ball, this is known as a strike, and no more balls are rolled in that frame. If the player knocks down all 10 pins, using both rolls, it is known as a spare. If there are pins still standing after both balls have been rolled, the score for that frame is the number of pins the player knocked down.

Here is a sample score sheet :

Frame -1- -2- -3- -4- -5- -6- -7- -8- -9- -10- Extra
Ball 1 8 6 X X 3 9 X 6 X 7 9
Ball 2 1 / . . 5 / . / . / .
Score 9 29 52 70 78 98 118 138 158 177 .

Explanation of scores:

The score shown at the bottom is cumulative. For instance the score for frame 2 is 10 (for the spare) plus the 10 on the next ball. That is added to the frame 1 score of 9 to yield a total score of 29 through the second frame. Similarly, the score for the third frame is 10 (for the strike) plus the 10 on the next ball, plus the 3 on the next ball, for a total of 23. That added to the previous score of 29 yields a total of 52 through the third frame.

The Task

Your assignment is to write a program that simulates the scoring of one player's bowling game. Your program should prompt the user for scores for each ball of each frame and stop prompting for scores at the end of the game. After the game is over, your program must produce a score sheet for the game.

Assumptions

Hints

Requirements

Sample Run

[102] a.out This is where the greeting goes Write your own version that explains the game of bowling, what this program does, and what is expected of the user Enter # of pins knocked down with the 1st ball of frame 1 : 8 the 2nd ball of frame 1 : 1 Enter # of pins knocked down with the 1st ball of frame 2 : 6 the 2nd ball of frame 2 : 4 You got a SPARE !! Enter # of pins knocked down with the 1st ball of frame 3 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 4 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 5 : 3 the 2nd ball of frame 5 : 5 Enter # of pins knocked down with the 1st ball of frame 6 : 9 the 2nd ball of frame 6 : 2 Number of pins must be between 0 and 1, inclusive Enter # of pins knocked down with the 2nd ball : 1 You got a SPARE !! Enter # of pins knocked down with the 1st ball of frame 7 : 15 Number of pins must be between 0 and 10, inclusive Enter # of pins knocked down with the 1st ball : -5 Number of pins must be between 0 and 10, inclusive Enter # of pins knocked down with the 1st ball : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 8 : 6 the 2nd ball of frame 8 : 4 You got a SPARE !! Enter # of pins knocked down with the 1st ball of frame 9 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 10 : 7 the 2nd ball of frame 10 : 3 You got a SPARE !! Enter # of pins knocked down with the 1st ball of the extra frame : 9 GAME OVER Frame | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Extra -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Ball 1 | 8 | 6 | X | X | 3 | 9 | X | 6 | X | 7 | 9 -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Ball 2 | 1 | / | | | 5 | / | | / | | / | -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Score | 9 | 29 | 52 | 70 | 78 | 98 | 118 | 138 | 158 | 177 | [103] a.out This is where the greeting goes Write your own version that explains the game of bowling, what this program does, and what is expected of the user Enter # of pins knocked down with the 1st ball of frame 1 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 2 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 3 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 4 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 5 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 6 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 7 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 8 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 9 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 10 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of the extra frame : 10 Enter # of pins knocked down with the 1st ball of the extra frame : 10 GAME OVER Frame | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Extra -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Ball 1 | X | X | X | X | X | X | X | X | X | X | 20 -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Ball 2 | | | | | | | | | | | -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Score | 30 | 60 | 90 | 120 | 150 | 180 | 210 | 240 | 270 | 300 | [104] a.out This is where the greeting goes Write your own version that explains the game of bowling, what this program does, and what is expected of the user Enter # of pins knocked down with the 1st ball of frame 1 : 7 the 2nd ball of frame 1 : 2 Enter # of pins knocked down with the 1st ball of frame 2 : 8 the 2nd ball of frame 2 : 2 You got a SPARE !! Enter # of pins knocked down with the 1st ball of frame 3 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 4 : 7 the 2nd ball of frame 4 : 3 You got a SPARE !! Enter # of pins knocked down with the 1st ball of frame 5 : 5 the 2nd ball of frame 5 : 4 Enter # of pins knocked down with the 1st ball of frame 6 : 8 the 2nd ball of frame 6 : 2 You got a SPARE !! Enter # of pins knocked down with the 1st ball of frame 7 : 10 Congratulations, you got a STRIKE !!! Enter # of pins knocked down with the 1st ball of frame 8 : 9 the 2nd ball of frame 8 : 1 You got a SPARE !! Enter # of pins knocked down with the 1st ball of frame 9 : 8 the 2nd ball of frame 9 : 2 You got a SPARE !! Enter # of pins knocked down with the 1st ball of frame 10 : 7 the 2nd ball of frame 10 : 1 GAME OVER Frame | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Extra -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Ball 1 | 7 | 8 | X | 7 | 5 | 8 | X | 9 | 8 | 7 | -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Ball 2 | 2 | / | | / | 4 | / | | / | / | 1 | -------+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+------ Score | 9 | 29 | 49 | 64 | 73 | 93 | 113 | 131 | 148 | 156 | [106]

Although your output need not be identical to the above, all information (including the greeting) must be present.

Submitting the Program

Since you must use separate compilation for this project, you will have several files that must be submitted for this project. The source file that contains main() MUST be called proj3.c, the file containing your functions MUST be called bowling.c, and the header file MUST be called bowling.h
To submit your project, type the following at the Unix prompt. Note that the project name starts with uppercase 'P'.

submit cs201 Proj3 proj3.c bowling.c bowling.h

Do NOT forget to submit your bowling.h file. Your program will NOT compile without it.

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show all files that you submitted in a format similar to the Unix 'ls' command.

submitls cs201 Proj3


CSEE | 201 | 201 S'00 | lectures | news | help

Monday, 27-Mar-2000 07:33:41 EST