Write a french-english dictionary lookup program

Assignment Help Computer Engineering
Reference no: EM132198934

Write a French/English dictionary lookup program. Read a list of pairs of English and French words from a file specified by the user.

English/French words should be exact matches (don't try to find partial matches).

Use the supplied EnglishFrenchDictionary.java class as your main class. Fill in the missing code in the DictionaryTable.java class to read the input file and perform the searches.

Add code to the DictionaryTable read() method to:

read pairs of lines (English word is on the first line, and the corresponding French word is on the second line), and for each pair of lines:

create an Item object for the English word and French word to store in the byEnglish array list

create an Item object for the French word and corresponding English word to store in the byFrench array list.

After reading all the words, sort the byEnglish and byFrench array lists so we can use binary search on them.

Add code to the DictionaryTable's findFrench() method to:

Create an Item object with the specified English word and null for the French word (because we don't know it yet)

Use the Collections.binarySearch() method to search for the matching Item in the byEnglish array list

If a matching Item is found, return the item's value which is the corresponding French word (hint: use getValue()).

Add similar code to the DictionaryTable's findEndlish() method to:

Create an Item object with the specified French word and null for the English word (because we don't know it yet)

Use the Collections.binarySearch() method to search for the matching Item in the byFrench array list

If a matching Item is found, return the item's value which is the corresponding English word (hint: use getValue()).


Two files have been supplied for testing your program: shortdictionary.txt and longdictionary.txt. found here: https://drive.google.com/drive/folders/0B41Z5suN4j28Um5xTEVSeGN0V0U?usp=sharing shortdictionary.txt has just a few words in it for quick testing, and longdictionary.txt has over 500 entries for more extensive testing.

The files have the format of an English word on one line, followed by the French word on the next line:

eight

huit

Amazon

amazone

april

avril

Arctic

arctique

British

britannique

. . .

A sample run of the program:

Enter the name of the dictionary file:

shortdictionary.txt

Lookup by E)nglish word, F)rench word, Q)uit?

F

Enter French word:

huit

English word: eight

Lookup by E)nglish word, F)rench word, Q)uit?

E

Enter English word:

eight

French word: huit

Lookup by E)nglish word, F)rench word, Q)uit?

Reference no: EM132198934

Questions Cloud

Write statements to compare the categories of salvation : Write a friend function called 'equal' for the class 'Enterprize' that was created above. The function takes two objects of this class and compares.
Project charter and established your scope statement : You are a project manager for a new hardware/software project. You just received the project charter and established your scope statement.
Marginal revenue from selling the third unit of output : Using this data, the marginal revenue from selling the third unit of output is:
How many tickets would the team be able to sell : How many tickets would the team be able to sell (ignoring capacity constraints) if it behaved competitively and set P=MC?
Write a french-english dictionary lookup program : Write a French/English dictionary lookup program. Read a list of pairs of English and French words from a file specified by the user.
How many firefighters will be hired : How many firefighters will be hired? Calculate the net total benefit to the group if 3 firefighters were hired. If there is a positive net total benefit.
The immigration reform and control act : The Immigration Reform and Control Act (IRCA) requires employers to verify the employment status of all employees,
Write a function that accepts a handle to a binary file : Write a function that accepts a handle to a binary file and prints the third last record in the file.
Write a short program to test your function : Write a function in C that takes three parameters: the address of a two-dimensional array of type int, the number of rows in the array.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Describe algorithm for constructing compact representation

Describe an algorithm for constructing the compact representation of a suffix trie, given its noncompact representation, and analyze its running time.

  What is signature analysis

Describe some of the ways in which a 68000 single-board computer can be designed to make it easier to test.

  Choose one of the ubuntu shells and discuss how you can

choose one of the ubuntu shells and discuss how you can perform a minimum of 20 commands or functions. these commands

  How frequently can the stuff bits used

Suppose a multiplexer has two input streams, each at a nominal rate of 1 Mbps. To accommodate deviations from the nominal rate, the multiplexer transmits at a rate of 2.2 Mbps as follows.

  Design "getter" methods for make and color

make a printAll() method. In this method, print the color and make of the automobile on one line in accordance to the sample session given below.

  Establish approval processes for sending communications

Develop a comprehensive security plan that does the following: Establish approval processes for sending communications.

  Construct a rudimentary implementation of a shell

Construct a rudimentary implementation of a shell. This will require knowledge of everything that we've learned so far (string manipulation, memory model) as well as a solid understanding of a powerful Unix primitive

  The mars program development environment

The program should begin by loading the contents of four signed integer operands (A, B, C, and D) from memory into registers.

  What is the current size of s

Suppose an initially empty stack S has performed a total of 25 push operations, 12 top operations and 10 pop operations. What is the current size of S?

  What transform a network to a secure network

How do I transform a network to the secure network? What tools should I have and what kind of hardware do I need to have a basic secure network.

  Write a program that prompts the user for their name

Write a program that prompts the user for their name. When they respond, write their name to a file called guest.txt.

  Analyze concisely and clearly your protocol a and b

Describe concisely and clearly your protocol A and B. Make the protocolsrealistic (think that you play it with your friends). Present small concrete examples for both protocol A and protocol B, and show how your protocols run in these cases.

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