Questions
7. Write a function that accepts a sentence as the argument and converts each word to...

7. Write a function that accepts a sentence as the argument and converts each word to “Pig Latin.” In one version, to convert a word to Pig Latin, you remove the first letter and place that letter at the end of the word. Then you append the string “ay” to the word. Here is an example: English: I SLEPT MOST OF THE NIGHTPIG LATIN: IAY LEPTSAY OSTMAY FOAY HETAY IGHTNAY.

In: Computer Science

***USING JAVA Scenario: You will be writing a program that will allow a user to find...

***USING JAVA Scenario: You will be writing a program that will allow a user to find and replace misspelled words anywhere in the phrase, for as many words as the user wishes. Once done (see example runs below), the program will print the final phrase and will show the Word Count, Character Count, the Longest Word and the Shortest Word.

Requirements:

Do not use Arrays for this assignment.

Do not use any String class methods (.phrase(), replace methods, regex methods) that parse the phrase for you. You will be writing the search and replace algorithm yourself

The blank spaces between words are not included when replacing a word. Your code should ignore them as it matches and replaces misspelled words.

For now, leave off any punctuation at the end of the phrase (or ignore it).

Make sure your code is neat and well structured / well-tabbed (this will help with debugging!), appropriately commented, with a comment header at the top.

This is a fantastic cumulative learning assignment. Write out pseudocode for this assignment and plan your implementation. This will help immensely!

Each occurrence of a misspelled word should be replaced, and I should be able to replace many different words through the use of the program (see below).

By “replaced” I mean that the final string that contains your phrase should contain the version with all misspellings desired by the user corrected.

If there are “longest” and “shortest” words that tie for character length, the most recent occurrence of either should “win.” For example: “Its either of or to but not both!” the shortest word would be “to”, the most recent shortest word towards the end of the phrase.

Due: Tuesday, September 24th by 11:59 p.m. on Canvas. (See Example Output on next page )

Short Run:

Please enter phrase to adjust: We aer teh Dukes of JMU

Enter word to be replaced: aer

Enter word to replace with: are

Current Phrase Version: "We are teh Dukes of JMU "

Continue Replacing Words? (y or n):y

Enter word to be replaced: teh

Enter word to replace with: the

Current Phrase Version: "We are the Dukes of JMU "

Continue Replacing Words? (y or n):n

Final Phrase:

============================

We are the Dukes of JMU

# of Words: 12

# of Characters: 24

Longest Word: "Dukes"

Shortest Word: "of"

============================

Longer Run:

Please enter phrase to adjust: When in teh course of humen events it becomes necessary for one poeple to dissolve the political bands that have connaected them with another

Enter word to be replaced:teh

Enter word to replace with:the

Current Phrase Version: "When in the course of humen events it becomes necessary for one poeple to dissolve the political bands that have connaected them with another "

Continue Replacing Words? (y or n):y

Enter word to be replaced:poeple

Enter word to replace with:people

Current Phrase Version: "When in the course of humen events it becomes necessary for one people to dissolve the political bands that have connaected them with another "

Continue Replacing Words? (y or n):y

Enter word to be replaced:connaected

Enter word to replace with:connected

Current Phrase Version: "When in the course of humen events it becomes necessary for one people to dissolve the political bands that have connected them with another "

Continue Replacing Words? (y or n):y

Enter word to be replaced:humen

Enter word to replace with:Human

Current Phrase Version: "When in the course of Human events it becomes necessary for one people to dissolve the political bands that have connected them with another "

Continue Replacing Words? (y or n):n

Final Phrase:

============================

When in the course of Human events it becomes necessary for one people to dissolve the political bands that have connected them with another

# of Words: 96

# of Characters: 141

Longest Word: "connected"

Shortest Word: "to"

============================

In: Computer Science

In English, with citations: Provide a summary of the procedures of banks in the check clearing...

In English, with citations:
Provide a summary of the procedures of banks in the check clearing system according to the Palestine Monetary Authority (PMA):

Word Limit,
Upper word limit: 1000 words
Lower word limit: 550 words

In: Accounting

Computer Architecture 1.The C in CPU stands for what word? 2.The P in CPU stands for...

Computer Architecture

1.The C in CPU stands for what word?

2.The P in CPU stands for what word?

3.The U in CPU stands for what word?

4.What are the 3 major components of the CPU?

In: Computer Science

The Reviews editor for a certain scientific journal decides whether the review for any particular book...

The Reviews editor for a certain scientific journal decides whether the review for any particular book should be short (1–2 pages), medium (3–4 pages), or long (5–6 pages). Data on recent reviews indicates that 60% of them are short, 30% are medium, and the other 10% are long. Reviews are submitted in either Word or LaTeX. For short reviews, 80% are in Word, whereas 40% of medium reviews are in Word and 30% of long reviews are in Word. Suppose a recent review is randomly selected.

a)What is the probability that the selected review was submitted in Word format?

b)If the selected review was submitted in Word format, what are the posterior probabilities of it being short, medium, or long? (Round your answers to three decimal places.)

In: Math

A (7, 4) error correcting Hamming code is designed with a generator matrix, G = ...

A (7, 4) error correcting Hamming code is designed with a generator matrix, G =   1 0 0 0 0 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 0 0 0 0 1 1 1 1   . (1) a) (10 points) Determine the code word for the message, 0110. b) (10 points) Determine the code word for the message, 1100. c) (9 points) Determine the syndrome vector for the received word, 0111011. d) (1 point) Correct the received word, 0111011. e) (9 points) Determine the syndrome vector for the received word, 1100111. f) (1 point) Correct the received word, 1100111.

In: Computer Science

C Code Edit this code to make it output all unique letters IN LOWERCASE of an...

C Code

Edit this code to make it output all unique letters IN LOWERCASE of an input file.

For example, with this input:

Raspberry Grapefruit Straw berry raspBERRY

Blue$$berry apple Pine_apple raspberry

The output should be:

raspberry

grapefruit

straw

berry

blue

berry

apple

pine

NOTE: Words with different capitlization, like raspberry and raspBERRY count as 1 unique word, so raspberry should only be seen once in the output.

#include <stdio.h>
#include <stdlib.h>

int main()
{
    //Pointer to access the file.
   FILE *file_ptr;

   //string to read each word.
   char word[100];


   // To open the file.
   file_ptr = fopen("input_text.txt", "r");
   if (file_ptr == NULL)
   {
       printf("No such file exist in current folder \n");
       exit(0);
   }


   //To read the file .
   while ( fscanf(file_ptr, "%s", word) != EOF)
   {
        printf("Word (%ld): ",strlen(word));
       printf ("%s\n", word);
   }
  
   //Close the file.
   fclose(file_ptr);
   return 0;
}

In: Computer Science

Read this entire document before beginning your lab. For this lab you are required to fulfill...

Read this entire document before beginning your lab.

For this lab you are required to fulfill all requirements exactly as described in this provided document, no less, no more.

Problem: 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.

        

Program Sample outputs

ex:1

Enter◦a◦word:◦ELEPhant↵ ↵
"ELEPHANT"↵
*l*p*a*t↵

ELEPhant

ex:2

Enter◦a◦word:◦Nancy_12A↵ ↵
"NANCY_12A"↵ *a*c*_*2*↵

Nancy_12A

Note 1: The use of libraries other than java.util.Scanner is prohibited.
Note 2: You may find the use of the following methods useful – charAt(), toLowerCase(), toUpperCase(), length().

in java

Note 3: Final thought, remember that your solution is case-sensitive and space-sensitive, fulfill the above instructions carefully and precisely.

In: Computer Science

Scrambled Word Game (Python) Topics: List, tuple In this lab, you will write a scrambled word...

Scrambled Word Game (Python)

Topics: List, tuple

In this lab, you will write a scrambled word game. The game starts by loading a file containing scrambled word-answer pair separated. Sample of the file content is shown below. Once the pairs are loaded, it randomly pick a scrambled word and have the player guess it. The number of guesses is unlimited. When the user guess the correct answer, it asks the user if he/she wants another scrambled word.

bta:bat
gstoh:ghost
entsrom:monster

Download scrambled.py and halloween.txt. The file scrambled.py already has the print_banner and the load_words functions. The function print_banner simply prints “scrambled” banner. The function load_words load the list of scrambled words-answer pairs from the file and return a tuple of two lists. The first list is the scrambled words and the second is the list of the answers. Your job is the complete the main function so that the game works as shown in the sample run.

Optional Challenge: The allowed number of guess is equal to the length of the word. Print hints such as based on the number of guess. If it’s the first guess, provides no hint. If it’s the second guess, provides the first letter of the answer. If it’s the third guess, provides the first and second letter of the correct answer. Also, make sure the same word is not select twice. Once all words have been used, the game should tell user that all words have been used and terminate.

Sample run:

Scrambled word is: wbe
What is the word? bee
Wrong answer. Try again!
Scrambled word is: wbe
What is the word? web
You got it!
Another game? (Y/N):Y
Scrambled word is: meizob
What is the word? Zombie
You got it!
Another game? (Y/N):N
Bye!

Provided code:

def display_banner():
    print("""

__                               _      _            _
/ _\ ___ _ __ __ _ _ __ ___ | |__ | | ___   __| |
\ \ / __|| '__|/ _` || '_ ` _ \ | '_ \ | | / _ \ / _` |
_\ \| (__ | | | (_| || | | | | || |_) || || __/| (_| |
\__/ \___||_|   \__,_||_| |_| |_||_.__/ |_| \___| \__,_|                                                       

""")

def load_words(filename):
    #load file containing scrambled word-answer pairs.
    #scrambled word and answer are sparated by :

    scrambled_list = []
    answer_list = []

    with open(filename, 'r') as f:
        for line in f:
            (s,a) = line.strip().split(":")
            scrambled_list += [s]
            answer_list += [a]
    return (scrambled_list, answer_list)

                       

def main():
    display_banner()
    (scrambled_list, answer_list) = load_words('halloween.txt')
    #your code to make the game work.     

main()

Halloween.txt file.

bta:bat
gstoh:ghost
entsrom:monster
ihtcw:witch
meizob:zombie
enetskol:skeleton
rpamevi:vampire
wbe:web
isdepr:spider
umymm:mummy
rboom:broom
nhlwaeeol:Halloween
pkiumnp:pumpkin
kaoa jlern tcn:jack o lantern
tha:hat
claabck t:black cat
omno:moon
aurdclno:caluldron

In: Computer Science

PYTHON Find anagrams of a word using recursion. This a possible run of your program: Enter...

PYTHON

Find anagrams of a word using recursion.

This a possible run of your program: Enter a word or empty string to finish: poster

The word poster has the following 6 anagrams:

presto

repost

respot

stoper

topers

tropes

In: Computer Science