Questions
Q3: Suppose that of all individuals buying a certain personal computer, 60% include a word processing...

Q3: Suppose that of all individuals buying a certain personal computer, 60% include a word processing program in their purchase, 40% include a spreadsheet program, and 30% include both types of programs. We are interested in knowing the inclusion of the programs.

a) Write out the sample space for the problem.

b) Find the probability that a word processing program was included given that the selected individual was included a spreadsheet program.

c) Are the vents “word processing program was included” and the event “selected individual was included a spreadsheet program” independent?

In: Statistics and Probability

1. It is quite interesting that most of us are likely to be able to read...

1. It is quite interesting that most of us are likely to be able to read and comprehend words, even if the alphabets of these words are scrambled (two of them) given the fact that the first and last alphabets remain the same. For example,

“I dn'ot gvie a dman for a man taht can olny sepll a wrod one way.” (Mrak Taiwn)

“We aer all moratls, Hamrbee is an immoratl, and tehre is no question abuot it.” (Kevin Unknown)

2. Write a method named scramble that returns a String and takes a String as an argument.

A. The argument is actually a word (of length 6 or more).

B. It then constructs a scrambled version of that word, randomly flipping two characters other than the first and last one.

3. Then write the main method in which you would read the word from the user, send it to scramble, and print the scrambled word.

A. You can use a loop to read multiple words if you like but it is not necessary.

B. If the length of the entered word is less than 6, you should keep prompting the user to enter a valid word.

4. After writing all the comments, generate a Javadoc and submit it with the java file.

Hint: First generate two random integers in range of the length of the string. Then use substring method to access characters at those locations. Rest is left to your imagination.

In: Computer Science

This is to done in Java: create the infrastructure for building a word cloud application. We...

This is to done in Java: create the infrastructure for building a word cloud application. We will do so by 1) Reading the content of a text file and creating a binary tree of words in that file. When a duplicate word is encountered. we simply increase the frequency count of that word in its corresponding node. In other words, the nodes in the tree have two parts. One part maintains the word, and the other maintains the frequency count. It should also be noted that words will not be case sensitive, hence three variations of the word (hello, Hello, HELLO), should be stored in the same node in the tree, and it should have a frequency of 3. 2) Once the binary tree of words (including their frequency) has been created, we need to print the words and their frequency count (one word per line). (Use InOrder() traversal to display the words and their frequency count) The data to be read is provided by the instructor in a text file and we are supposed to use FileReader to read character by charcter and use delimiters like spaces,endofline, tab, etc., to figure out when the words begin and end, and store the words in the binary tree nodes. No duplicate nodes, instead increment frequency counter in each node. I have a basic grasp of how this should work in theory but I can't quite figure it out in code.

In: Computer Science

Please, write code in c++. Using iostream library Most modern text editors are able to give...

Please, write code in c++. Using iostream library

Most modern text editors are able to give some statistics about the text they are editing. One nice statistic is the average word length in the text. A word is a maximal continuous sequence of letters ('a'-'z', 'A'-'Z'). Words can be separated by spaces, digits, and punctuation marks. The average word length is the sum of all the words' lengths divided by the total number of words.

For example, in the text "This is div2 easy problem". There are 5 words: "This"is"div"easy" and "problem". The sum of the word lengths is 4+2+3+4+7 = 20, so the average word length is 20/5 = 4.

Given a text, return the average word length in it. If there are no words in the text, return 0.0.

Input
The first line will contain the text of length between 0 and 50 characters inclusive. Text will contain only letters ('a'-'z', 'A'-'Z'), digits ('0'-'9'), spaces, and the following punctuation marks: ',', '.', '?', '!', '-'. The end of text will be marked with symbol '#' (see examples for clarification).

Output
Output should contain one number - the average length. The returned value must be accurate to within a relative or absolute value of 10-9.


Samples:

Input Output
1 This is div2 easy problem.# 4.0
2 a bc# 1.5
3 w84lFC1hD2ot2?43 Jnw67Kmt8KhOQn# 2.714285714

In: Computer Science

#include <stdlib.h> #include <stdio.h> #include <string.h> void clrScreen(int lines){     int i = 0;     for( i =...

#include <stdlib.h>

#include <stdio.h>

#include <string.h>

void clrScreen(int lines){

    int i = 0;

    for( i = 0; i < lines; ++i ){

        printf("\n");

    }

    return;

}

void printRules(void){

    printf("\t|*~*~*~*~*~*~*~*~*~ How to Play ~*~*~*~*~*~*~*~*~*~|\n");

    printf("\t|   This is a 2 player game. Player 1 enters the   |\n");

    printf("\t|   word player 2 has to guess. Player 2 gets a    |\n");

    printf("\t|   number of guesses equal to twice the number    |\n");

    printf("\t|   of characters. EX: If the word is 'example'    |\n");

    printf("\t|   player 2 gets 14 guesses.                      |\n");

    printf("\t|*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~|\n");

    clrScreen(10);

    return;

}

//------------------------------------------------------------------------------------------------------------

/* /\DO NOT MODIFY ABOVE THIS LINE /\*/

void playGame(){

int correctGuess = 1;

    char garbage;

clrScreen(40);

    printRules();

    printf("Player 1: Enter a word smaller than 50 characters: ");

    clrScreen(40);

    if( -1 == correctGuess ){

        printf("CoNgRaTuLaTiOnS!!!!!! You figured out the word!!!\n");

        printf("\t\t%s\n");

    } else {

        printf("You didn't figure out the word.....it was %s\n");

        printf("Better luck next time!\n");

    }

    printf("Press 'enter' to continue to main menu.\n");

    scanf("%c", &garbage);

}

int menu(void){

    int loop = 1;

    while( loop ){

        clrScreen(40);

        printf("*~*~*~*~*~*~*~*~*~*~Welcome to Hangman!*~*~*~*~*~*~*~*~*~*~\n");

        printf("\t1.) Play the game\n");

        printf("\t2.) Quit\n");

        printf("Please make a selection: ");

    }

}

/*

    hangman game RULES:

    2 player game

        player 1

            enter a word for player 2 to guess

            enter a number of guesses player 2 gets to have. It must be at least 2x as big

                as the number of letters in the word.

            For example, if you enter the word 'sky' you must give the player at least 6 guesses.

        player 2

            try to guess the word player 1 has entered.

            you get X number of guesses

*/

int main(void){

    return 0;

}

//In c programming language

//please help me finish this hangman program. Thank you.

In: Computer Science

java: Sample output: Aoccdrnig to reacresh at an Elingsh uinervtisy, it deos not mttaer in waht...

java:

Sample output: Aoccdrnig to reacresh at an Elingsh uinervtisy, it deos not mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer are in the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae we do not raed ervey lteter by it slef but the wrod as a wlohe and the biran fguiers it out aynawy.

PROGRAM DESCRIPTION: In this assignment, you will read an unspecified number of lines of text from STDIN. Input is terminated with EOF (ctrl-d for keyboard input). Your only output, to STDOUT, will echo the input except that the letters of any word with more than three characters will be randomly shuffled (except for the first and last letters). Don't scramble any punctuation, and you may assume that punctuation will only occur at the end of a word. Any word will have, at most, one punctuation character. Punctuation does not count towards the length of the word. You may also assume that each word will be separated by one space and that a line will have no leading or trailing whitespace. Blank lines are allowable. You must preserve the newlines (output must have the same number of lines and the same number of words on each line as when input.) (A word, here, is defined as a sequence of alphanumeric characters delimeted by whitespace.) For this assignment you must code the shuffle algorithm as described in class, and not a library shuffle function.

Sample input:According to research at an English university, it does not matter in what order the letters in a word are, the only important thing is that the first and last letter are in the right place. The rest can be a total mess and you can still read it without a problem. This is because we do not read every letter by itself but the word as a whole and the brain figures it out anyway.

Sample run:

This is a test
This is a tset
Hello, how are you today?
Hlleo, how are you toady?

SUGGESTIONS

You may find it easiest to complete this program in stages. Begin by writing a program that echos input lines of text to output. Then add the ability (a function) to break a line of text into individual words, finally add the scrambling feature (another function) for a word.

In: Computer Science

Draft a project scope statement for the TIMS system and describe the constraints. Please be specific....

Draft a project scope statement for the TIMS system and describe the constraints. Please be specific.

  • Use Microsoft Office Word to write your project scope statement.
  • Submit the Microsoft Office Word document in this drop box as an attachment

In: Operations Management

Discuss one of the theories of development during middle childhood. (PLEASE DO NOT COPY WORD FROM...

Discuss one of the theories of development during middle childhood.

(PLEASE DO NOT COPY WORD FROM WORD FROM A SOURCE!!!! ALSO PLEASE GIVE REFERENCES FROM WEBSITES OR ANY OTHER SOURCES PLEASE!!! THANK YOU!!)

In: Psychology

Write a Python program that reads a file, input by the user, containing one word/token per...

Write a Python program that reads a file, input by the user, containing one word/token per line with an empty line between sentences. The program prints out the longest word found in the file along with its length.

In: Computer Science

In this program, you will generate a random “sentence” constructed of random “words”. Quotes are used...

In this program, you will generate a random “sentence” constructed of random “words”. Quotes are used in the preceding sentence because the “words” will mostly be nonsense words that do not exist in the English language.

Step 1. The average number of words in an English sentence is about 17 words. First generate a pseudorandom number NW between 10 and 20 for the number of words in your random “sentence”. Use srand( ) to set the initial value in the iterative algorithm within the rand( ) function. Given NW, initialize a for-loop for(i=0; i

Step 2. To generate a pseudorandom “word” within the for-loop above, you first need to generate a pseudorandom number NL for the number of letters in the “word”.
The number of letters in a word follows the following probability table. two-letter words 0.20 three-letter words 0.27 four-letter words 0.22 five-letter words 0.14 six-letter words 0.09 seven-letter words 0.08 -------------------------------- Total = 1.00
Think of generating a pseudorandom value NL between 0.0 and 1.0 and choosing the number of letters in the “word” using the pseudorandom value according to the following: If NL >= (0.00) and NL <= (0.20), then the number of letters in the word will be two. If NL> (0.20) and NL <= (0.20+0.27), then the number of letters in the word will be three. If NL> (0.20+0.27) and NL <= (0.20+0.27+0.22), then the number of letters in the word will be four. If NL> (0.20+0.27+0.22) and NL <= (0.20+0.27+0.22+0.14), then the number of letters in the word will be five. If NL> (0.20+0.27+0.22+0.14) and NL <= (0.20+0.27+0.22+0.14+0.09), then the number of letters in the word will be six.
If NL> (0.20+0.27+0.22+0.14+0.09) and NL <= (0.20+0.27+0.22+0.14+0.09+0.08), then the number of letters in the word will be seven.
Notice that there are 6 intervals, representing NL=2 to NL=7. To assign a number of letters NL in the “word”, declare a 6-cell 1-D float array prob_letters[ ] and load the 1-D array with the probability sums from above. float prob_interval[6]={ 0.2, 0.47, 0.69, 0.83, 0.92, 1.0};
Now generate a pseudorandom value x between 0.0 and 1.0 x=rand( )/(float)RAND_MAX; Initialize the number of letters NL to 2: NL=2; Now check if x lies in one of the other five intervals for NL=3 to NL=7. If so, assign NL to the number of letters for that interval. for(i=1; i<6; i++){ if(x>= prob_interval[i-1] && x<= prob_interval[i])NL=i+2; }
Two important Notes : Important Note 1 : A better way to generate the 1-D array of interval values prob_interval[ ] is to start from the probabilities for the occurrencess of NL=2 through NL=7. float prob_interval[6]={ 0.2, 0.27, 0.22, 0.14, 0.09, 0.08}; Then form the array elements as the sums for(i=1; i<6; i++){ prob_interval[i]= prob_interval[i]+ prob_interval[i-1]; } Use this approach in the

Step 3 below. Important Note 2. : The array prob_interval[ ] should be generated only one time, before you begin any looping. Do not generate this array over-and-over-again, by incorrectly placing it inside the loop in Step 1. Step 3. Print out a “word” of length NL letters to the display. This “word” will be constructed from pseudorandom letters a-z. Start with a for-loop for(j=0; j a 0.085 b 0.021 c 0.045 d 0.034 e 0.112 f 0.018 g 0.025 h 0.030 i 0.075 j 0.002 k 0.011 l 0.055 m 0.030 n 0.067 o 0.07 p 0.032 q 0.002 r 0.076 s 0.057 t 0.070 u 0.036 v 0.011 w 0.013 x 0.002 y 0.018 z 0.002 ---------------- total 1.000
Use the method from Step 2. You can make use of the sequential ascii character codes for letters ‘a’ through ‘z’. float prob_let[26]= {0.085, 0.021, 0.045, 0.034, 0.112, 0.018, 0.025, 0.030, 0.075, 0.002, 0.011, 0.055, 0.030, 0.067, 0.071, 0.032, 0.002, 0.076, 0.057, 0.070, 0.036, 0.011, 0.013, 0.002, 0.018, 0.002}; Important Note: The first letter of the first word in the sentence should be printed as capitalized; i.e. uppercase. Step 4. Place a blank space after the “word” printed in Step 3, or place a period after the “word” printed in Step 3 if it is the last “word” in the sentence. Your results should look like: Elfh gfk llae mjlodp noc tjvjs mlknko si. Note, we haven’t applied any rules such as: 1. a “minimum of one vowel per word”; 2. ‘t’ is often followed by ‘h to form ‘th’; 3. ‘s’ often occurs at the end of a word to form a plural; 4. etc.. so actual words will only appear infrequently

In: Computer Science