Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9456988

Have any Question?


Related Questions in Computer Engineering

Youre trying to save to buy a new 190000 bmw 3 series

You're trying to save to buy a new $190,000 BMW 3 series sedan. You have $40,000 today that can be invested t your bank. The bank pays 4.8% annual interest on its accounts.  How long will it be before you have enough to ...

Planks plants had net income of 4000 on sales of 70000 last

Plank's Plants had net income of $4,000 on sales of $70,000 last year. The firm paid a dividend of $1,480. Total assets were $200,000, of which $80,000 was financed by debt. a. What is the firm's sustainable growth rate? ...

Questions -question 1 a digital computer has a memory unit

Questions - Question 1: A digital computer has a memory unit with 16 bits per word. The instruction set consists of 122 different operations. All instructions have an operation code part (opcode) and an address part (all ...

This requires to use minitabthe following are the results

This requires to use Minitab The following are the results from a 2 5  design: Treatment       Response            Treatment       Response (1)                    700                     e                   800 a         ...

Research the web for an example of a startup using a cloud

Research the Web for an example of a startup using a cloud infrastructure. What were the main reasons for choosing a cloud infrastructure? What alternatives did the startup have? Answer should be at least 1 page long dou ...

Submit your solution as a plain-text file with a c

Submit your solution as a plain-text file with a .c extension in the name. Name timer - counts down to zero from a user supplied number. Description Displays a count down to zero from a number supplied by the user at the ...

Discuss why a financial services organization would benefit

Discuss why a financial services organization would benefit from using one framework over another (COSO, COBIT,) -- choose a framework or frameworks that in your opinion would be most ideally suited for such an organizat ...

Q1 state whether the following is true or false and why1

Q1. State whether the following is true or false and why: (1) Monopolists can charge whatever price they want and maximize profit since they are price makers.  T/F: Why? (2) A firm that has a monopoly on a certain good m ...

Answer the following question research management in a

Answer the following Question : Research management in a field and compare it with the field in software. Compare the management techniques with that field you chose to software project management. The response must be t ...

Suppose a countrys real gdp is 18 trillion andnbspthat

Suppose a country's real GDP is $18 trillion and that population is 300 million. Instructions:  Enter your answers as whole numbers. a. What is this country's real GDP per capita? $  Suppose that during the next 10 years ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As