Question

Array Processing - Dictionary Program NOTE: Review the parallel array example from class Another method of...

Array Processing - Dictionary Program NOTE: Review the parallel array example from class Another method of "Sequentially Searching an Array" is covered in the book in Chapter 8. Using Notepad, write psuedocode ONLY for the following situation. Create and load an array with the following 7 values. Add one more word (of your own choosing) for a total of 8 words. biff comely fez mottle peruke bedraggled quisling Create a second array (parallel array). To hold the defintions to these words. You will need to look up the definitions. - Be sure to use lowercase, as shown above. This will make the processing easier. - Use an external .TXT file to load the words and the definitions into the arrays ( words.txt and definitions.txt). Ask the user to enter a word - Search through this array until you find a match with the word the user entered. - Once you find a match, output "Yes, that word is in the dictionary" and output the definition. - If you get to the end of the array and do NOT find a match, output "No, that word is not in the dictionary". - The program should work with any set of words and definition in the arrays. If I were to change the words and definitions in the arrays, it should still work.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Psuedocode:

START
        // initialising arrays wordsArray and defArray with size 8
        len = 8 // length of array
        wordsArray[len]
        defArray[len]
        // open words.txt file and write each line to wordsArray array
        wFile = open "words.txt"
        i = 0 // maintains index of array
        for each line in wFile:
                wordsArray[i] = line
                i++
        // open definitions file and write each line to defArray array
        defFile = open "definitions"
        j = 0 // maintains index of array
        for each line in defFile:
                defArray[j] = line
                j++
        // take input a word to search from user
        searchWord = input from user
        // boolean flag to check word found in array or not
        found = false
        // iterate on the array of wordsArray
        for k = 0 to (len - 1):
                // if search word matches with the current word in the array at index k
                // print definition of this word stored at kth index in defArray array
                if wordsArray[k] == searchWord:
                        print "Yes, that word is in the dictionary"
                        print defArray[k]
                        break // break the loop if search successfull
        // if search is unsuccessfull
        if found == false:
                 "No, that word is not in the dictionary"
END

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 START // initialising arrays wordsArray and defArray wit

Add a comment
Know the answer?
Add Answer to:
Array Processing - Dictionary Program NOTE: Review the parallel array example from class Another method of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • in c++ sample output Description A dictionary is a collection of words that contain at least...

    in c++ sample output Description A dictionary is a collection of words that contain at least one definition. One way to represent a dictionary is through the use of an array, actually two arrays. For a dictionary to print the term with matching definition, each array: Must contain the same number of elements as the other array Each element in array 1 (term) must contain a match in array 2 (definition). 1. 2. Take the following array examples: Array 1=...

  • Write a program that employs the four letter word dictionary to check the spelling of an...

    Write a program that employs the four letter word dictionary to check the spelling of an input word (test word). You will need to save the dictionary file to a folder on your computer. For this program you will prompt the user to enter a four letter word (or four characters). Then using a loop read each word from the dictionary and compare it to the input test word. If there is a match then you have spellchecked the word....

  • In this lab you will write a spell check program. The program has two input files:...

    In this lab you will write a spell check program. The program has two input files: one is the dictionary (a list of valid words) and the other is the document to be spellchecked. The program will read in the words for the dictionary, then will read the document and check whether each word is found in the dictionary. If not, the user will be prompted to leave the word as is or type in a replacement word and add...

  • This lab will combine reading data from a file and searching the array to find a...

    This lab will combine reading data from a file and searching the array to find a specific value. Assignment Write a program that reads in a file full of strings into an array, and prompts the user for a string to find in the array. The program should loop until a sentinel value (such as -1) is entered. After looping in main() for the input, write a search function, with the following prototype: int findWord(string [], int, string); with arguments...

  • Overview In this exercise you are going to recreate the classic game of hangman. Your program...

    Overview In this exercise you are going to recreate the classic game of hangman. Your program will randomly pick from a pool of words for the user who will guess letters in order to figure out the word. The user will have a limited number of wrong guesses to complete the puzzle or lose the round. Though if the user answers before running out of wrong answers, they win. Requirements Rules The program will use 10 to 15 words as...

  • Assignment #6 - Arrays and Strings - Making random sentences! Due: Tuesday April 2, 11:59:00 pm...

    Assignment #6 - Arrays and Strings - Making random sentences! Due: Tuesday April 2, 11:59:00 pm Objective This assignment will consist of writing a program that involves practice with arrays, random number generation, and Strings. You may use c-strings or string objects here, however, string objects is recommended. Exercise Filename: sentences.cpp Write a program that uses random-number generation to create sentences. Create four arrays of strings (string objects highly suggested over c-strings) called article, noun, verb, and preposition. The arrays...

  • In C++ Please!!!!! Example main: #include <iostream> #include <fstream> #include <istream> #include <cstring> using namespace std;...

    In C++ Please!!!!! Example main: #include <iostream> #include <fstream> #include <istream> #include <cstring> using namespace std; const int MAXRESULTS = 20; // Max matches that can be found const int MAXDICTWORDS = 30000; // Max words that can be read in int main() { string results[MAXRESULTS]; string dict[MAXDICTWORDS]; ifstream dictfile; // file containing the list of words int nwords; // number of words read from dictionary string word; dictfile.open("words.txt"); if (!dictfile) { cout << "File not found!" << endl; return...

  • Python program This assignment requires you to write a single large program. I have broken it...

    Python program This assignment requires you to write a single large program. I have broken it into two parts below as a suggestion for how to approach writing the code. Please turn in one program file. Sentiment Analysis is a Big Data problem which seeks to determine the general attitude of a writer given some text they have written. For instance, we would like to have a program that could look at the text "The film was a breath of...

  • Assignment 4 Real Deal: Crier On Us Some word games, like Scrabble, require rearranging a combination of letters to make...

    Assignment 4 Real Deal: Crier On Us Some word games, like Scrabble, require rearranging a combination of letters to make a word. This type of arrangement is generally referred to as an anagram, it's known as a permutation in mathematics. This assignment will give you some experience thinking about and writing recursive functions. Write a C++ program that searches for ``anagrams'' in a dictionary. An anagram is a word obtained by scrambling the letters of some string. For example, the...

  • Lab #7 CSE110 - Arizona State University Topics • Basic arrays Coding Guidelines • Give identifiers...

    Lab #7 CSE110 - Arizona State University Topics • Basic arrays Coding Guidelines • Give identifiers semantic meaning and make them easy to read (examples numStudents, grossPay, etc). • Keep identifiers to a reasonably short length. • Use upper case for constants. Use title case (first letter is upper case) for classes. Use lower case with uppercase word separators for all other identifiers (variables, methods, objects). • Use tabs or spaces to indent code within blocks (code surrounded by braces)....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT