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

  Identify the quality attributes the system will need

Identify the quality attributes this system will need for its architecture. Construct a matrix of quality attributes (nonfunctional requirements) that you've identified.

  Design an fir linear-phase filter

Use MATLAB to design an FIR linear-phase filter that models a low pass band limited channel that has a 1/2 -dB ripple in the pass band I ƒ I = 3000 Hz.

  Write a routine to identify concave polygons

Write a routine to identify concave polygons by calculating cross products of pairs of edge vectors.

  Prepare a program that allows the user to pick a file

Write a program that allows the user to pick a file, doubles the red value of each pixel in the picture, and shows the picture.

  Design an application that will receive the weight of parcel

You will need to design an application that will receive the weight of a parcel and calculate and display the cost per kg and the delivery charge for that parcel.

  Create a flash movie that uses motion animation

Create a Flash movie that uses motion animation to show a ball bouncing continuously between the top and bottom of the right side of the stage.

  How anyone could be more productive by using the given apps

Describe the presentation to show how anyone could be more productive by using these apps either professionally or personally.

  What fields you believe would be primary keys

Be sure to include the field type and size. Please do not jump ahead and try to create tables. now I'm just looking for a list of fields. This is somewhat vague on purpose. I want you to decide what is required in the database.

  Explain two types of computer attacks/ viruses

In order to limit the creation of malicious code, do you think that access to elements of document object model and some Javascript functionality be limited? In discussing the answer, describe two types of computer attacks/ viruses that may be ini..

  Analyze the need for waterfall and agile methodologies

Explain waterfall methodologies and identify their relationship to the PMBOK process groups. Analyze the need for waterfall and agile methodologies.

  Determine the minimum number of timeslots required

COMP 9020- Assignment. For this problem in particular determine minimum number of timeslots required. Explain how this can formulated as graph-based problem

  Write the pseudocode for a program that accepts data

Write the pseudocode for a program that accepts data for an order number, customer name, wood type, number of characters, and color of character.

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