Amendments Instead of reading several lines of text, just hard-code the following text in the program myString= “The quick Brown Fox jumps over the Lazy Dog and the !##! LAZY DOG is still sleeping”. Use a very small set of text (like “Ab#C#d” ) to test/debug your program first.   The program should make use of a function that converts the text to lower case (need to create your own conversion logic) and then perform the analysis in the main function. Ignore any numbers, symbols or special characters, etc in the text if any. Note : It’s easier to create a new string for the result instead of modifying the original string.   Instead of the three methods outlined in the original question, complete only part a and part b. Assume maximum length is 10 for part b.   Turn in one program that contains part a and b. Output Original text: The quick Brown Fox jumps over the Lazy Dog and the !##! LAZY DOG is still sleeping Modified text: the quick brown fox jumps over the lazy dog and the  lazy dog is still sleeping   Letter  Count a            2 b           1 Word length       Occurrences 1                          0 2                         1   Required: Use two 2 dimensional arrays to emulate the tables that will capture the result of the analysis. One for part a and another for part b. Use loops to initialize the array values. Indent your code/ provide comments when implementing somethings that require some logic. Do not use 26 if statements to check for each letter.  Use range of the alphabet (like between the starting and ending ASCII value of the letters). Create a function that will Accept two strings: target and source Copy from source to target; process only A-Z and a-z, converting all upper case letters to lower case and ignoring everything else. Hints: Part a. Since we have 26 letters, then we can use an array with 26 rows.  Each row can hold value for the actual letter and another value for the count. //Create an two dimensional array like below. You can use char instead of int to keep track of count too! char letter_count_array[26][2];   // 26 rows & 2 columns The following statements assign to the first row, the letter ‘a’ to the first column and 5 to the second column.  This represents the letter ‘a’ was used 5 times in the sentence. letter_count_array[0][0]=’a’; letter_count_array[0][1]=5;

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Text book : “C How to program 8th Edition” using chapters 1 to 8 

Amendments

  • Instead of reading several lines of text, just hard-code the following text in the program
    1. myString= “The quick Brown Fox jumps over the Lazy Dog and the !##! LAZY DOG is still sleeping”.
    2. Use a very small set of text (like “Ab#C#d” ) to test/debug your program first.

 

  • The program should make use of a function that converts the text to lower case (need to create your own conversion logic) and then perform the analysis in the main function. Ignore any numbers, symbols or special characters, etc in the text if any.

Note : It’s easier to create a new string for the result instead of modifying the original string.

 

  • Instead of the three methods outlined in the original question, complete only part a and part b. Assume maximum length is 10 for part b.

 

  • Turn in one program that contains part a and b.

Output

Original text:
The quick Brown Fox jumps over the Lazy Dog and the !##! LAZY DOG is still sleeping

Modified text:
the quick brown fox jumps over the lazy dog and the  lazy dog is still sleeping

 

Letter  Count

a            2

b           1

Word length       Occurrences

1                          0

2                         1

 

Required:

Use two 2 dimensional arrays to emulate the tables that will capture the result of the analysis. One for part a and another for part b.

Use loops to initialize the array values.

Indent your code/ provide comments when implementing somethings that require some logic.

Do not use 26 if statements to check for each letter.  Use range of the alphabet (like between the starting and ending ASCII value of the letters).

Create a function that will

  1. Accept two strings: target and source
  2. Copy from source to target; process only A-Z and a-z, converting all upper case letters to lower case and ignoring everything else.

Hints:

Part a.

Since we have 26 letters, then we can use an array with 26 rows.  Each row can hold value for the actual letter and another value for the count.

//Create an two dimensional array like below. You can use char instead of int to keep track of count too!

char letter_count_array[26][2];   // 26 rows & 2 columns

The following statements assign to the first row, the letter ‘a’ to the first column and 5 to the second column.  This represents the letter ‘a’ was used 5 times in the sentence.

letter_count_array[0][0]=’a’;

letter_count_array[0][1]=5;

8.31 (Text Analysis) The availability of computers with string-manipulation capabilities has re-
sulted in some rather interesting approaches to analyzing the writings of great authors. Much atten-
tion has been focused on whether William Shakespeare ever lived. Some scholars find substantial
evidence that Christopher Marlowe actually penned the masterpieces attributed to Shakespeare. Re-
searchers have used computers to find similarities in the writings of these two authors. This exercise
examines three methods for analyzing texts with a computer.
a) Write a program that reads several lines of text and prints a table indicating the number
of occurrences of each letter of the alphabet in the text. For example, the phrase
To be, or not to be: that is the question:
contains one "a," two “bs," no "cs," and so on.
b) Write a program that reads several lines of text and prints a table indicating the number
of one-letter words, two-letter words, three-letter words, and so on, appearing in the
text. For example, the phrase
Whether 'tis nobler in the mind to suffer
contains
Word length Occurrences
1
2
2
3
1
2 (including tis)
6.
2
7
1
Text book : "C How to program 8th Edition"
Amendments
1) Instead of reading several lines of text, just hard-code the following text in the program
a. myString= "The quick Brown Fox jumps over the Lazy Dog and the !##! LAZY DOG is still
sleeping".
Transcribed Image Text:8.31 (Text Analysis) The availability of computers with string-manipulation capabilities has re- sulted in some rather interesting approaches to analyzing the writings of great authors. Much atten- tion has been focused on whether William Shakespeare ever lived. Some scholars find substantial evidence that Christopher Marlowe actually penned the masterpieces attributed to Shakespeare. Re- searchers have used computers to find similarities in the writings of these two authors. This exercise examines three methods for analyzing texts with a computer. a) Write a program that reads several lines of text and prints a table indicating the number of occurrences of each letter of the alphabet in the text. For example, the phrase To be, or not to be: that is the question: contains one "a," two “bs," no "cs," and so on. b) Write a program that reads several lines of text and prints a table indicating the number of one-letter words, two-letter words, three-letter words, and so on, appearing in the text. For example, the phrase Whether 'tis nobler in the mind to suffer contains Word length Occurrences 1 2 2 3 1 2 (including tis) 6. 2 7 1 Text book : "C How to program 8th Edition" Amendments 1) Instead of reading several lines of text, just hard-code the following text in the program a. myString= "The quick Brown Fox jumps over the Lazy Dog and the !##! LAZY DOG is still sleeping".
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY