Questions
A word is said to be “abecedarian” if the letters in the word appear in alphabetical...

A word is said to be “abecedarian” if the letters in the word appear in alphabetical order. For example, the following are all six-letter English abecedarian words:

abdest, acknow, acorsy, adempt, adipsy, agnosy, befist, behint,
beknow, bijoux, biopsy, cestuy, chintz, deflux, dehors, dehort,
deinos, diluvy, dimpsy

Write a method called isAbecedarian that takes a String and returns a boolean indicating whether the word is abecedarian.

In: Computer Science

code in. c++ void seen ); If there is already a Word object in the Words...

code in. c++

void seen );
If there is already a Word object in the Words list, then the number of occurrences for this word is incremented. If there is no Word object for this word already, create a new word object with occurrence =1, and insert this object into the list of Word objects.

getNextWord();
Returns the next word of the list and sets the currentItem pointer to the next Word. This may return an empty string, “”, if the pointer is NULL.
StackNode* findWord(std::string);
Returns a pointer to some Word in the list. Return NULL if not found.

Write a driver to do the following:

Create a Words object. This is a linked list of Word objects.

Open an input file full of mixed words. Read each word. For each word in the input file, call the seen method for this word. The seen method takes a string argument. For example, the word ‘cat’ was just read in. Call myWords.seen(“cat”).

After processing all of the words in the file, close the file.

Last, print out the statistics of the file to the console. Include:
For every word in the Words object, print the word and the number of occurrences. The total number of Words in the file.

complete

#ifndef WORD_H_
#define WORD_H_
#include <string>;

class Word
{
private:
        std::string word;
        int occurrences;
public:
        Word(std::string w); //word = w and occurrences = 1
        std::string getWord() const; //return the stored word
        int getOccurrences() const;
        void increment();       //increment the occurrences value
};

#endif

complete

#ifndef WORDS_H_
#define WORDS_H_
#include <string>;
#include "Word.h";

class Words
{
        private:
                struct StackNode
                {
                        Word word;
                        StackNode *next;
                };

                StackNode *top;
                StackNode *currentItem;
                StackNode* findWord(std::string); //Returns a pointer to some Word in the list
                                                                                        // return NULL if not found
        public:
                Words() // Create an empty list of Word objects
                        {       top = NULL;
                                resetNextWord();
                        }
                void remove(std::string); //remove a word object, if it is in the list
                bool find(std::string) const; //if the word, as a string, is in the list, return true. else false
                void seen(std::string); //pass in a word, as a string, that has been seen.
                                                // If this word is not in the list, insert it with
                                                // the number of occurrences = 1.
                                                // If this word is in the list, increment the
                                                // occurrences for this word.
                int getOccurrences(std::string) const; //return the value of occurrences
                int getLength() const;          // returns the length of the list. NOT STORED
                std::string getNextWord();      // returns the next word of the list and sets
                                                                        // the currentItem pointer to the next Word
                void resetNextWord(); //resets the currentItem pointer to top.
                bool isEmpty() const;
};

#endif

In: Computer Science

Write a program that asks the user to enter a bunch of words until they type...

Write a program that asks the user to enter a bunch of words until they type the word “quit”. Count how many words had 5 letters or more.

Sample program

Enter a word: nothing

Enter a word: stop

Enter a word: word

Enter a word: program

Enter a word: supercalifragilisticexpialidocious

Enter a word: quit

You entered 3 words that were longer than 5 letters.

In: Computer Science

(C LANGUAGE) Write a function called upperLower that inputs a line of text into char array...

(C LANGUAGE) Write a function called upperLower that inputs a line of text into char array s[100]. Output the line in uppercase letters and in lowercase letters

This is what I have so far:

void * upperLower (const char * s) {
char *word[sizeof(s)];
for(int i = 0; i < sizeof(s); i++){
*word[i] = s[i];
}
word = strtok(word, " ");

int counter = 0;
while(word != NULL){
if(counter % 2 == 0){
word[counter] = toupper(word);
printf("%s ", word);
}
else{
word[counter] = tolower(word);
printf("%s ", word);
}
counter++;
word = strtok(NULL, " ");
}
}

The method cannot be changed. Must use void * upperLower (const char * s) {

The output should be like THIS is A test

In: Computer Science

Write a function checkvertical(board, word, row, col), which returns True if the word word can be...

Write a function checkvertical(board, word, row, col), which returns True if the word word can be added to the board starting at position board[row][col] and going down. The restrictions are (1) it has to fit entirely on the board, (2) it has to intersect and match with one or more non-blank letters on the board, and (3) it cannot change any letters on the board, other than blanks (that is, overlapping mismatches are not allowed).

My program isn't working :( Can anyone fix the program?

My program:

def checkvertical(board, word, row, col):

if len(word) > 20 - row:

return False

matchesoneletter = False

for k in range(len(word)):

wordletter = word[k]

boardletter = board[row + k][col]

if wordletter == boardletter:

matchesoneletter = True

if boardletter == blank:

continue

elif boardletter != wordletter:

return False

return matchesoneletter

In: Computer Science

*****MUST ONLY USE****** #include <iostream> #include <fstream> #include <string.h> #include <stdio.h> Description The word bank system...

*****MUST ONLY USE******
#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>


Description

The word bank system maintains all words in a text file named words.txt. Each line in the text file stores a word while all words are kept in an ascending order. You may assume that the word length is less than 20.

The system should support the following three functions:

  • Word lookup: to check whether a given word exists in the word bank.
  • Word insertion: to insert a new word into the word bank. No insertion should be made if the word already appears in the word bank.
  • Word deletion: to delete a word from the word bank.

Please also make sure that

  • After insertion, the order of words in the text file should be kept in ascending order.
  • After deletion, there should not be any empty lines in the text file.
  • After deleting the last word from the system, the system should still keep an empty words.txt.

Implementation

  • Start your coding with the skeleton code and create a text file words.txt next to the C++ file.
  • You don't need to change the function headers.
  • Complete three core functions lookup, insert_word and delete_word.

Expected Output

Below is a sample run of the program. Assume that the file words.txt is empty initially.

1 for lookup; 2 for insertion; 3 for deletion; q for quit: 2
Please enter the word you want to insert: cat
The word "cat" is inserted successfully!

1 for lookup; 2 for insertion; 3 for deletion; q for quit: 2
Please enter the word you want to insert: apple
The word "apple" is inserted successfully!

1 for lookup; 2 for insertion; 3 for deletion; q for quit: 2
Please enter the word you want to insert: dog
The word "dog" is inserted successfully!

1 for lookup; 2 for insertion; 3 for deletion; q for quit: 1
Please enter the word you want to search for: car
The word "car" is not found!

1 for lookup; 2 for insertion; 3 for deletion; q for quit: 1
Please enter the word you want to search for: cat
The word "cat" is found!

1 for lookup; 2 for insertion; 3 for deletion; q for quit: 2
Please enter the word you want to insert: cat
The word "cat" already exists!

1 for lookup; 2 for insertion; 3 for deletion; q for quit: 3
Please enter the word you want to delete: cat
The word "cat" is deleted successfully!

1 for lookup; 2 for insertion; 3 for deletion; q for quit: 3
Please enter the word you want to delete: car
The word "car" is not in the file!
        

Then, below is the expected content of the text file words.txt.

apple
dog
        

Hints

For word insertion and deletion tasks, creating a temporary file may simplify lots of work. This approach is particularly useful if the word bank is large such that you cannot read the whole word bank into memory. For the lab tasks, there are two useful functions for file operation that you may use:

  • rename for renaming a file
  • remove for deleting a file

In addition, we read and manipulate words through char array. The following two functions could be helpful:

  • strcmp for comparing two strings
  • strcpy for copying a string from one char array to another

======================Skeleton Code================================

#include <iostream>
#include <fstream>
#include <string.h>
#include <stdio.h>

using namespace std;

#define N 20


// search for a word in the input file, return true if found
bool lookup(const char filename[], const char word[]){
        return false;
}


// delete a word in the input file
// the result should not contain blank lines
void delete_word(const char filename[], const char word[]){
}


// insert a word in the input file such that the words are in ascending order
// it should not insert duplicate word
void insert_word(const char filename[], const char word[]){
}


int main(){

        const char filename[] = "words.txt";
        char choice;
        char word[N];

        while (true){
                cout << "1 for lookup; 2 for insertion; 3 for deletion; q for quit: ";
                cin >> choice;

                if (choice == '1'){
                        cout << "Please enter the word you want to search for: ";
                        cin >> word;
                        if (lookup(filename, word)){
                                cout << "The word \"" << word << "\" is found!" << endl;
                        }else{
                                cout << "The word \"" << word << "\" is not found!" << endl;
                        }
                }else if (choice == '2'){
                        cout << "Please enter the word you want to insert: ";
                        cin >> word;
                        insert_word(filename, word);
                }else if (choice == '3'){
                        cout << "Please enter the word you want to delete: ";
                        cin >> word;
                        delete_word(filename, word);
                }else if (choice == 'q'){
                        break;
                }else{
                        cout << "Invalid input. Please input again." << endl;
                }
                cout << endl;
        }

        return 0;
}

In: Computer Science

Create a C++ project called RobberyLanguage. Ask the user to enter a word. Write a function...

Create a C++ project called RobberyLanguage. Ask the user to enter a word. Write a function that will receive the word, use the word to compile a new word in Robbery language and return the new Robbery language word. In the function: Use a while loop and a newline character (‘\0’) to step through the characters in the original string. How to compile a word in Robbery language: Double each consonant and put the letter ‘o’ between the two consonants. For example:" ENTER THE WORD: Welcome

original word is welcome , Robbery language: wowelolcocomome

process returned 0 (0*0) execution time :

press any key to continue "

Example of the definition of the function: string compileRobLanWord(char word[50]) Hints: Declare a new character string for the Robbery language word. A word in Robbery language has more characters than the original word. Therefor the new string must have its own index value. How it looks like in memory: Original word: S a m \0 2 0 1 2 3 Robbery language: S o S a m o m \0 0 1 2 3 4 5 6 7 Note: Remember to add the \0 character as the last character of the new word. In the main function: Example of the call statement in the main function: newWord = compileRobLanWord(word); Display the original word and the Robbery language word.

C#(VISUAL STUDIO)

In: Computer Science

MATLAB Program a Matlab version of Guess the Word. The word should be determined by user...

MATLAB

Program a Matlab version of Guess the Word. The word should be determined by user input.
Once the word is determined, the game should begin by displaying blanks (-) where
all the letters of the word are. The game should then continue to prompt the player to
guess a letter in the word. If the player guesses a letter that is in the word and not
already displayed, that letter should be displayed everywhere it appears in the word.
If the player guesses a letter that is not in the word or a letter that is in the word
but has been guessed before, one try should be added. This should continue until the player completes either the word or until they have reached 6 tries, at which point the game should end which the message: "You ran out of tries and lost."

In: Computer Science

in java Read in a word and display the requested characters from that word in the...

in java

Read in a word and display the requested characters from that word in the requested format. Write a Java program that

  • ● prompts the user for a word and reads it,

  • ● converts all characters of the input word to uppercase and display the word with a double quotation mark ( " ) at the start and end of the word,

  • ● displays the word with all characters whose index is odd in lower case and for the rest of the characters displaying a * instead of the character,

  • ● finally displays the original word as it was entered by the user.

    Based on the previous specifications your program should behave and look exactly as shown in the cases below. Your program should work for any word entered by the user, not just the ones in the samples.

    Below illustrates how your program should behave and appear.

    Note that ◦ symbol indicates a space and ↵ is a new line character. All words except for user input (in blue) must be exactly as indicated in the sample. Any extra “spaces” and/or “new lines” will be graded a wrong answer.

        

In: Computer Science

Prove that if two non-equal letters are interchanged in a ISBN code word the error will...

Prove that if two non-equal letters are interchanged in a ISBN code word the error will be detected (the word is no longer an ISBN code word)

Prove that the ISBN code can detect any single error ( if a letter was transmitted incorrectly the word is no longer an ISBN code word)

In: Advanced Math