The board game scrabble

Assignment Help Basic Computer Science
Reference no: EM13166870

The board game Scrabble works by assigning points to wooden tiles that are marked with printed letters, and are arranged as interlocking words on a Scrabble board. It's described here: Scrabble. We'll simplify this considerably, and consider the following question. We begin with the letter-scoring scheme from Scrabble: a = 1, b = 3, c = 3, d = 2, ..., z = 10. Given a text file - a novel for example, what is the token in the file with the highest scoring density? Token density is calculated as follows: First, letters are assigned their scrabble score. All non-letters (e.g., period, comma, etc.) have score 0. A token's density equals the sum of the scrabble values of its characters, divided by the length of the token. Some examples: Token Score cab 7/3 = 2.33 (note: standard division, not Java integer division) cab! 7/4 = 1.75 (token length is now 4, '!' has value 0) zzz 30/3 = 10.0 Your solution should be in two classes, a driver class called DenseScrabbleTester, which includes main and uses Scanner to identify an external file for dense Scrabble study, and a class called DenseScrabble, which does the heavy lifting for the application. The DenseScrabble class must extend Echo, in the way we've indicated in Chapter 10. Submit the code for these two classes in the boxes below. Output: your program should report the (or a) highest density token in the input file, along with the density value for that token, and the line number in the file the token appeared on. Tips: Make sure you master Chapter 10 of the text as a prelude to doing this problem. Here is a list from a to z of the letter scores from Scrabble: {1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10} Notice that this list is in proper format for copying and pasting directly into your program as an int array. It's far easier to convert lines of text to lowercase before processing. If you're not sure how to extract letter scores from the scrabble value array, above, you should view the short movie embedded in section 7.1 in the text. Use the StringTokenizer constructor with just one argument (so the only delimiter is white space - punctuation should figure in the token density calculation, as it does in the "cab!" example above). You MUST use a try-catch harness in the driver class. You MUST comment every method with a one line description of the job that method does, and your description must be placed just below the method header line. Two sample files are provided: sampletext.txt is silly but useful, and HeartOfDarkness.txt is the famous novella by Joseph Conrad. Some sample output: enter file name sampletext.txt winner: now score 2.0 Line number: 1 ------------------------------- enter file name HeartOfDarkness.txt winner: buzz score 6.0 Line number: 759

Reference no: EM13166870

Questions Cloud

How many grams of cr are formed : Chromium is produced by reacting its oxide with aluminum. If 76 g of Cr2O3 and 27 g of Al completely react to form 51 g of Al2O3, how many grams of Cr are formed?
Comparison of pptp, l2tp and sstp : Provide a brief comparison of PPTP, L2TP and SSTP, outlining the advantages and disadvantages of each. Which organizations might choose to implement a VPN service hosted on a Windows Server 2012 system?
What volume would the gas occupy at stp : Consider a steel tank whose volume is 49.0 L and which contains O2 gas at a pressure of 18100 kPa at 29°C. What volume would the gas occupy at STP?
Calculate the molar concentration of radon in the water : A sample consisting of various gases contains 3.1×10-6 mole fraction of radon. This gas at a total pressure of 34 is shaken with water at 30 . Calculate the molar concentration of radon in the water.
The board game scrabble : The board game Scrabble works by assigning points to wooden tiles that are marked with printed letters, and are arranged as interlocking words on a Scrabble board.
What is the average thickness of the sheet in meters : If a 200 piece of gold (density =19.32 ) is hammered into a sheet measuring 2.5 by 1.0 ft , what is the average thickness of the sheet in meters?
Find the mass of carbon : A substance containing 28.84% Nitrogen, 0.0648g Hydrogen, and Oxygen and Carbon, with (total) mass (of the substance) 1.2953, is burned in excess oxygen to produce 2.241 grams of carbon dioxide.
What is the total combined mass of carbon dioxide : An automobile gasoline tank holds 27kg of gasoline,when the gasoline burns, 85kg of oxygen is consumed, and carbon dioxide and water is produced. What is the total combined mass of carbon dioxide and water?
How many groups could be formed : A dancehall contains 173 men and 238 women. A certain "promenade" calls for the formation of groups, with each group consisting of one man with two women.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Simple math quiz that asks a user

Construct a simple math quiz that asks a user to answer a math problem of your choice. On the form, place one text box (txtAnswer) and two command buttons (cmdAskQuestion and cmdVerifyAnswer).

  What is effect of control hazards on cpi for pipeline

What is the effect of control hazards on the CPI for this pipeline? Consider the two cases of "predict branch not taken" and "predict branch taken".

  Explaining statement for security policy

Write a statement for security policy for the following:Let LAN for small 100-person business, Pixel Inc. Business occupies one floor in office building. Everybody has a computer on his or her desk.

  Computing requirements for dozen handbags

Leather-goods factory manufactures ?ve styles of handbags, whose variable contributions are $30, $40, $45, $25, and $60 per dozen, respectively.

  How many register window should be saved to memory as result

Assume two more calls are made after the maximum value from part (a) is reached. How many register windows must be saved to memory as a result?

  Create the logic for a program

Create the logic for a program that continuously prompts the user for a number of dollars until the user enters 0. Pass each entered amount to a conversion method that displays a breakdown of the passed amount into the fewest bills; in other words..

  How will decision meet accessibility guidelines

Knowing that this violates Redundancy Principle, but wanting to accommodate employees with disabilities, what would you suggest instead? How would your decision meet accessibility guidelines?

  Function in programs to print upside down triangles

Apply function in programs to prints triangles, upside down triangles, and diamond.

  Website has a duty to be familiar with drug laws

Assume a foreign website sells drugs which are not approved by regulatory agencies for sale to citizens of another country. Do you believe that website has a duty to be familiar with drug laws throughout the world?

  Create two-page written analysis for problem statement

Create a two-page written analysis based on the following specification: Problem statement, Possible outcomes if no action taken (this one is mine and the only thing i have to do) Alternative actions.

  Button subprocedure to store user-s name in cell

If you wish to take in and store user's name in cell A1 by having them type their name following prompt declaring "Give me your name, Earthling!" that code excerpt must you use within button subprocedure?

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd