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

  Discuss specific example of highly effective malware attacks

Collect and summarise two resources that discuss specific examples of highly effective malware attacks. The resources must not be about the same malware.

  What exactly are static and dynamic chains

Do I have although information to do this problem and What exactly are the static and dynamic Chains? I am not a programmer and I am trying to get this right.

  Identify components used in building an IT infrastructure

SBM4104 IT Infrastructure Assignment - Poster. Identify and classify the different components used in building an IT infrastructure

  Se using your own knowledgehpw an atm is used develop a set

using your own knowledgehpw an atm is used develop a set of use that could be used to derive the requirements for an

  What is difference between AMPS and D-AMPS cellular systems

What is primary difference between AMPS and D-AMPS cellular systems? What is primary difference between AMPS cellular systems and newer PCS mobile telephones?

  Write a complete program that repeatedly reads integers

Write a complete C++ program that repeatedly reads integers from the key-board, stopping input when that repeated reads integers or zero.

  Discuss examples of roles you would separate and why

Discuss examples of roles you would separate and why. Submit a summary of your learning as a bulleted list that explains importance of separation of duties.

  Explain the concepts of object orientation methodology

Explain the concepts of object orientation methodology. Describe the activities in each phase of the system development life cycle.

  Explain why you chose advantage and challenge that you did

Explain why you chose the advantage and challenge that you did, and provide one real-world example of each environment.

  What do you understand by just-in-time compilation

What do you understand by just-in-time compilation? How is it different from traditional interpretation and compilation? Explain using a figure.

  Compute the average value of an array of floating-point

Write a c++ program that computes the average value of an array of floating-point data.

  What smallest number of stack frames required by superpowers

ACTIVITY: Questions for superpowers. What's the best case? I.e., for a given n, what's the smallest number of stack frames required by superpowers

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