lab0 - 15-121 FALL 2009 [CORTINA]LAB 0: Review of Java...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 15-121 FALL 2009 [CORTINA]LAB 0: Review of Java BasicsEXERCISESIn the game of Scrabble, players create words on a crossword puzzle grid using letter tiles. Each letter tile has a value: Players can also use a blank tile (worth 0 points) to substitute for any letter. The score for a word is the sum of the values of the letter tiles. 1. Write a simple Java program that prompts the user to enter a word and outputs the Scrabble score for that word, based on the point values of the letters only. A blank tile should be entered as an asterisk (*). For this part, you may assume that the input word is valid and consists of only lowercase letters. In your solution, you should include a method that returns the Scrabble point value of a given character. If the character is not a letter, return 0. Try to write your method so you don't test for each letter individually, using an ifor switchstatement. HINT: Set up an array to hold all of the letter scores, and then use the position of each letter in the alphabet to extract out the corresponding score...
View Full Document

This note was uploaded on 12/19/2009 for the course CS 121 taught by Professor Reid-miller during the Spring '09 term at Carnegie Mellon.

Page1 / 2

lab0 - 15-121 FALL 2009 [CORTINA]LAB 0: Review of Java...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online