Read and prints highest valued legal scrabble word

Assignment Help Computer Networking
Reference no: EM13763573

You are to write a program that will read a file of scrambled 7-letter strings, and then prints out the highest valued legal Scrabble word(s). Before reading the file, your program will store a list of words read from the file words.txt. That file contains both legal and illegal words. Scrabble words are up to seven letters long, and are only composed of lowercase alphabetic characters. Your program will have to avoid storing the illegal words.

Your program should have a Word class that contains 1) a real Scrabble word stored in a string; and 2) the Scrabble value of the word. These Words must be stored in a set. You must create a map of letters to values, and use the map in determining the value of a word. The values, from 'a' to 'z' are 1, 3, 3, 2, 1, 4, 2, 4, 2, 8, 5, 1, 3, 1, 1, 3, 10, 1, 1, 1, 1, 4, 4, 8, 4, and 10. I initialized an array of shorts, named
values, with these values, and then inserted them into the map.

The toughest part of this program is designing an algorithm to test all of the permutations of the file string and its substrings. You must use rotate and/or next_permutation to help in this task. Besides pp. 878-879 in the text, you will find more information on the web by searching for "STL rotate", or "next_permutation". You are not allowed to use any arrays or pointers in this program, other than the array of shorts named values. Your program must compile without warnings when compiled with -Wall -ansi. Your output must match mine exactly!

You will find words.txt, File1.txt, and my scrabble.out in ~ssdavis/40/p8

[ssdavis@lect1 p8]$ cat File1.txt
abcdefg
ableujk
ttabeed
olbisha
abjects
ytvxyzk
[ssdavis@lect1 p8]$ scrabble.out File1.txt
9 abcdefg: badge cafe face
15 ableujk: jake juke
10 ttabeed: abetted
13 olbisha: abolish
17 abjects: abject
0 ytvxyzk: No words found.
[ssdavis@lect1 p8]$

Reference no: EM13763573

Questions Cloud

Analyze and establish budgets : The information from these statements is used to analyze and establish budgets, forecast, variance reports, and ratios, among other things, with the key being that they are only used internally).
Waste of money for such a small change : It is more likely than not that the expenditure of an additional $2m will deter Maytag from entering the market as GE's profits continue to rise and the demand curve continues to shift to the right, even though at a slower pace than if Maytag did ..
Information on a mnc-publicly-traded company : Search the Internet for information on a MNC, publicly-traded company. Download the annual report for the most recent year reported; review the information contained on the company Website and proxy statement for use in this assignment. Review and..
Homicides committed with firearms : The difference between a perforating gunshot wound and a penetrating gunshot wound?
Read and prints highest valued legal scrabble word : You are to write a program that will read a file of scrambled 7-letter strings, and then prints out the highest valued legal Scrabble word(s). Before reading the file, your program will store a list of words read from the file words.txt.
Discuss the concept of domestic containment : Discuss the concept of "domestic containment". How did this concept operate in 1950's-1960's America? Why was it destined to ultimately fail? Give an example of one of the values present in domestic containment.
Read and prints highest valued legal scrabble word : You are to write a program that will read a file of scrambled 7-letter strings, and then prints out the highest valued legal Scrabble word(s). Before reading the file, your program will store a list of words read from the file words.txt.
Auditing cash and cash equivalents : Describe why there is a big emphasis placed on auditing cash and cash equivalents. Address the following:
What do you think of when you use the word church : What do you think of when you use the word church? How much of this is biblical and how much is cultural? Please explain and include material from your reading.

Reviews

Write a Review

Computer Networking Questions & Answers

  Create diagram for proposed network topology

Use Microsoft Visio 2007 to create diagram for proposed network topology. Write down the proposal for research group explaining why that design would best meet their requirements.

  Essay about effective of wireless technology

Write an essay about effective of wireless technology on PHYCHOLOGICAL CONSIDERATIONS and CULTURAL CONTEXT

  Identify and briefly explain any four key requirements

An organization called Ranbaxy Inc. has currently 3 divisions in 3 different locations within Sydney city. One of the divisions serves as the company headquarters.

  Subnetting mask

Suppose a subnet with prefix 128.119.40.128/26. Provide an example of one IP address (of the form xxx.xxx.xxx.xxx) which can be allocated to this network.

  Maximum ethernet payload

Host B can send TCP acknowledgements to host A, even though it has no data to send - experiment in which host A blasts a 26 Megabyte file to host B through a single TCP Tahoe connection over a 1 Gigabit/sec Ethernet. B transmits no data. Neither ho..

  Write recursive subroutine to calculate factorial function

Write down simple (closed) subroutine sum(A,n) to sum the array of n integers and return result un EDSAC using "initial orders. Write down recursive subroutine fact(n) which calculates factorial function.

  Assume there are n nodes

Assume there are N nodes connected to a wireless access point (AP) operating on IEEE 802.11b, and every node has at least one packet to send at a given time.

  Ciphertext which was encoded with a shift cipher

the following ciphertext which was encoded with a shift cipher: xultpaajcxitltlxaarpjhtiwtgxktghidhipxciwtvgtpilpitghlxiwiwtxgqadds.1. Perform an attack against the cipher based on a letter frequency count: How many letters do you have to identify th..

  The general method for constructing the parameters of the

the general method for constructing the parameters of the rsa cryptosystem can be described asnbspfollows select two

  Evluate the effectiveness and efficiency mobile-based

there are thousands of iphone apps ipad apps and android apps that have been developed to perform a myriad of tasks and

  Determine whether a packet should get destroyed

Packets are destroyed if they get "lost" and keep traveling the internet without arriving at a destination. What is parameter is evaluated to determine whether a packet should get destroyed?

  What network connectivity do propose between the sites

what network connectivity do you propose between the sites? How will this support the disaster-recovery vision and the need to replicate data between the sites?

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