In: Computer Science
In: Computer Science
Write a program to perform the following two tasks:
1. The program will accept a string as input in which all of the words are run together, but the first character of each word is uppercase. Convert the string to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string "StopAndSmellTheRose" would be converted to "Stop and smell the rose". Display the result string.
2. Then the program will convert each word in the result string of task 1 into "Pig Latin" and display the result string. In one version of Pig Latin, you convert a word by removing the first letter, placing that letter at the end of the word, and then appending "ay" to the word.
For example, for the result string "Stop and smell the roses" in task 1, the Pig Latin string should be "topSay ndaay mellsay hetay osesray"
Hints:
1. In the first task, the first letter of a sentence should always be uppercase. Starting from the second letter to the last letter, if the letter is an uppercase (be cautious with I), that means it is the beginning of a new word. What you need to do is to insert a space before that uppercase letter, and change that uppercase letter to lowercase.
Python has isupper() function to check if a string or a character is uppercase, islower to check if a string or a character is lowercase
you may need a variable to remember the beginning index of a word and the ending index of a word. So you can use the two indexes to extract the word from the input phrase.
to add a space after a word, you can use the + operator as long as both operands are strings/characters
2. In the second task (pig Latin task), the result string of the first task should be passed as argument when you call the function you define for the second task.
You may need to use:
the index to access individual character (particularly the first character of each word in the sentence)
move the first character to the end of the word
add "ay" at the end of the word
Requirements:
In: Computer Science
Write a program to perform the following two tasks:
1. The program will accept a string as input in which all of the words are run together, but the first character of each word is uppercase. Convert the string to a string in which the words are separated by spaces and only the first word starts with an uppercase letter. For example, the string "StopAndSmellTheRose" would be converted to "Stop and smell the rose". Display the result string.
2. Then the program will convert each word in the result string of task 1 into "Pig Latin" and display the result string. In one version of Pig Latin, you convert a word by removing the first letter, placing that letter at the end of the word, and then appending "ay" to the word.
For example, for the result string "Stop and smell the roses" in task 1, the Pig Latin string should be "topSay ndaay mellsay hetay osesray"
Hints:
1. In the first task, the first letter of a sentence should always be uppercase. Starting from the second letter to the last letter, if the letter is an uppercase (be cautious with I), that means it is the beginning of a new word. What you need to do is to insert a space before that uppercase letter, and change that uppercase letter to lowercase.
Python has isupper() function to check if a string or a character is uppercase, islower to check if a string or a character is lowercase
you may need a variable to remember the beginning index of a word and the ending index of a word. So you can use the two indexes to extract the word from the input phrase.
to add a space after a word, you can use the + operator as long as both operands are strings/characters
2. In the second task (pig Latin task), the result string of the first task should be passed as argument when you call the function you define for the second task.
You may need to use:
the index to access individual character (particularly the first character of each word in the sentence)
move the first character to the end of the word
add "ay" at the end of the word
Requirements:
In: Computer Science
c++ question
Question 2: X = 7777
Modify the code below and use conditional branching (if, else,
etc.)
to print the following:
if X is between 0 and 33333 then print the word: red
if X is between 33334 and 66666 then print the word: blue
if X is between 66667 and 99999 then print the word: green
if none of the above condition matches then print the word:
white
In: Computer Science
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 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
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 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 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