import java.util.Scanner; // This program uses a method letterValue to determine the numeric value of a letter
Fantastic news! We've Found the answer you've been seeking!
Question:
import java.util.Scanner;
// This program uses a method letterValue to determine the numeric value of a letter in Scrabble
// Scrabble values:
// A,E,I,O,U,L,N,S,T,R = 1
// D,G = 2
// B,C,M,P = 3
// F, H, V, W, Y = 4
// K = 5
// J, X = 8
// Q, Z = 10
public class ScrabbleValue
{
/**
Finds the point value of a letter in Scrabble
@param ch the character to be evaluated
@return the letter point value (int)
*/
public static int letterValue(char ch)
{
int value = 0;
//-----------Start below here. To do: approximate lines of code = 23
// Use a switch statement to determine the value of a letter and return that value.
// See the comments above for Scrabble values.
// Convert ch to an uppercase letter first before using it in the switch statement
Related Book For
Posted Date: