Honors Computer Science I



Honors Computer Science I

Program 1: Scrabble Calculator

Assigned: 1/7/08 (Monday)

Due: 1/14/08 (Monday 11:55pm over WebCT)

The Problem

Given potential words in the game of Scrabble, you are to write a program that calculates the score of that word. To simplify matters, you will not have to calculate scores of multiple words formed by placing a single word, calculate the score of any word or letter bonus, worry if what is entered is a real English word, or have to worry about blank tiles. All you will have to do is given a word, return the score of that word on its own in the game of Scrabble. Use the internet or the game (if you own it) to determine the scores of each of the tiles 'A' through 'Z'.

Input/Output Specification

Your program should prompt the user whether or not they want to enter a word. If the user enters yes (check for "y", "yes", "Y", and "Yes"), then prompt the user for a word. Read in this word and then output a single line with the following format:

The Scrabble score of W is X.

where W is the word entered by the user and X is its score in scrabble.

You may assume that the word entered by the user will be no longer than 29 characters. You may also assume that the word entered by the user ONLY contains uppercase letters.

Your program should continue prompting the user to enter another word until the user says no.

Implementation Restrictions

You must use the following struct:

struct tile {

char letter;

int score;

};

You must also create an array of this struct, dynamically, using malloc. (Yes, I know this is inefficient with respect to solving the problem, but I just want you to have a bit of practice with structs.)

You must create a function that takes in a character (guaranteed to be an uppercase letter) and returns an integer corresponding to that letter's Scrabble score.

Sample Run

Would you like to enter a word to be scored?

Yes

What word would you like scored?

HELLO

The Scrabble score of HELLO is 8.

Would you like to enter a word to be scored?

y

What word would you like scored?

ZOO

The Scrabble score of ZOO is 12.

Would you like to enter a word to be scored?

yes

What word would you like scored?

KNOWN

The Scrabble score of KNOWN is 12.

Would you like to enter a word to be scored?

no

Thanks for using the Scrabble Calculator!

Deliverables

Turn in a single file, scrabble.c, over WebCT that solves the specified problem. Make sure to include ample comments and use good programming style, on top of the requirements that are given in the program description above. If you decide to make any enhancements to this program, clearly specify them in your header comment so the grader can test your program accordingly. Regardless of the enhancements you make, you should make it easy for him to grade the functionality specified in this description.

Grading Specifications

Here is a rough breakdown of how your assignment will be graded:

Documentation and Style: 10-15%

Following Implementation Restrictions: 15-20%

General Logic and Program Layout: 15-20%

Execution Points: 45-60%

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download