subject

In this problem, you will write a translation program. First your program will prompt the user for three filenames. The first file is a dictionary. Each line contains a regular English word followed immediately by a vertical bar ($\verb#|#$) followed immediately by the word or phrase that the word should be translated to. For example, if I wanted to translate $\verb#'hello'#$ as $\verb#'hola'#$, one entry in the file would be $\verb#hello|hola#$. The second file should contain a text to translate. You may assume that words in this file are separated by spaces and that there is no other punctuation (including periods at the ends of sentences). The last filename should be for an output file. The program will then take each word in the input file and translate it based on the dictionary. In other words, if the word appears on the left side of a bar in the dictionary file, the program will replace it with whatever is on the right side of the bar. If the word does not appear on the left side of a bar, it is kept as is in the output. (Note, though, that you do not have to preserve case in the output---if a word is capitalized in the input, it does not have to be capitalized in the output.) All the words should be written to the output file. Other than prompting for the filenames, there should be no other output to the IDLE shell.

For example, using the provided files $\verb#pirateWords. txt#$ and $\verb#myInput. txt#$, a run of your program could look like this:
Enter name of dictionary: pirateWords. txt
Enter name of text to translate: myInput. txt
Enter name of output file: myOutput. txt

There should be nothing printed, and the contents of $\verb#myOutput. txt#$ would be:
avast i have come to swipe ye filthy lucre
ye filthy lucre or ye life

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:30
Given the following code: if (n == 2) { k -= 2; } else if (n == 3) { k -= 3; } can be rewritten as: if (< condition > ) { < assignment statement > ; } assume that evaluating < condition > does not change the values stored in n and k. which of the following could be used as < assignment statement > ? k -= n; k -= 1; k -= 2; k += n; k = n - k;
Answers: 2
question
Computers and Technology, 22.06.2019 05:30
The total revenues for a company are $150,223 and the total expenses were 125,766. if you are calculating the net income, which of these spreadsheets would you use? insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2-b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2+b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2/b3. the formula should be showing in the formula bar. insert a spreadsheet with $150,223 in cell b2 and 125, 766 in cell b3. enter a formula =b2*b3. the formula should be showing in the formula bar.
Answers: 3
question
Computers and Technology, 22.06.2019 22:20
Pp 4.1 design and implement a class called sphere that contains instance data that represents the sphere’s diameter. define the sphere constructor to accept and initialize the diameter and include getter and setter methods for the diameter. include methods that calculate and return the volume and surface area of the sphere (see pp 3.5 for the formulas). include a tostring method that returns a one-line description of the sphere. create a driver class called multisphere, whose main method instantiates and updates several sphere objects.
Answers: 1
question
Computers and Technology, 23.06.2019 00:00
Suppose you have 9 coins and one of them is heavier than others. other 8 coins weight equally. you are also given a balance. develop and algorithm to determine the heavy coin using only two measurements with the of the balance. clearly write your algorithm in the form of a pseudocode using the similar notation that we have used in the class to represent sorting algorithms
Answers: 1
You know the right answer?
In this problem, you will write a translation program. First your program will prompt the user for t...
Questions
question
Mathematics, 15.12.2020 03:00
question
English, 15.12.2020 03:00
question
Mathematics, 15.12.2020 03:00
question
Social Studies, 15.12.2020 03:00
Questions on the website: 13722367