programming test

2

Click here to load reader

Upload: roy-moore

Post on 10-Nov-2015

4 views

Category:

Documents


0 download

DESCRIPTION

Programming Test

TRANSCRIPT

Programming Pre-Interview Exercise

For a Scrabble like game words entered into the game require scoring. These scores are based upon the letters used in each word, and also the length of the word. Each letter is scored with a number between 1 and 9 (details in the table below), and the score based on the letters is calculated by the summation of these values.

If the word contains two or more of the same character in a row (i.e a double letter) then an additional 3 points are awarded.

This score is then multiplied by the score multiplier based on the length of the word (detailed below)The words entered for must be single words, and any punctuation characters contained in the word must be ignored. Multiple words passed for scoring are considered to be an error case and should be handled appropriately.Letter Scores

A1N3

B4O1

C2P5

D3Q7

E1R2

F2S1

G2T2

H3U2

I2V8

J5W5

K3X9

L2Y5

M3Z8

Length of Word MultipliersLength of wordScore Multiplier

1-4 characters1

5-6 characters2

7-9 characters3

9+ characters4

Scoring Examples

Input word: QueenLetter Score = 7 + 2 + 1 + 1 + 3 = 14Multiple letter bonus for ee: 3Multiplier = 2Total Score = 17 * 2 = 34Input word: geographyLetter Score = 2 + 1 + 1 + 2 + 2 + 1 + 5 + 3 + 5 = 22Multiplier = 3Total Score = 22 * 3 = 66

Provide a simple console application to drive your implementation of the scoring. Your implementation should be in .NET 3.5 (or later) targeting the .NET Framework 3.5 (or later). In your scoring implementation consider all the usual things you consider in production quality code. Please also include any supporting code (prototypes, tests, etc). Your submissions will form part of a discussion in your technical interview.