Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your assignment is to write a C++ program to read in a file of English text....... john1_niv.txt 1. In the beginning was the Word, and

Your assignment is to write a C++ program to read in a file of English text.......

image text in transcribedimage text in transcribedimage text in transcribed

john1_niv.txt

1. In the beginning was the Word, and the Word was with God, and the Word was God. 2 He was with God in the beginning. 3 Through him all things were made; without him nothing was made that has been made. 4 In him was life, and that life was the light of all mankind. 5 The light shines in the darkness, and the darkness has not overcome it.6 There was a man sent from God whose name was John. 7 He came as a witness to testify concerning that light, so that through him all might believe. 8 He himself was not the light; he came only as a witness to the light.9 The true light that gives light to everyone was coming into the world. 10 He was in the world, and though the world was made through him, the world did not recognize him. 11 He came to that which was his own, but his own did not receive him. 12 Yet to all who did receive him, to those who believed in his name, he gave the right to become children of God 13 children born not of natural descent, nor of human decision or a husbands will, but born of God.14 The Word became flesh and made his dwelling among us. We have seen his glory, the glory of the one and only Son, who came from the Father, full of grace and truth.15 (John testified concerning him. He cried out, saying, This is the one I spoke about when I said, He who comes after me has surpassed me because he was before me.) 16 Out of his fullness we have all received grace in place of grace already given. 17 For the law was given through Moses; grace and truth came through Jesus Christ. 18 No one has ever seen God, but the one and only Son, who is himself God and is in closest relationship with the Father, has made him known.John the Baptist Denies Being the Messiah19 Now this was Johns testimony when the Jewish leaders in Jerusalem sent priests and Levites to ask him who he was. 20 He did not fail to confess, but confessed freely, I am not the Messiah.21 They asked him, Then who are you? Are you Elijah?He said, I am not.Are you the Prophet?He answered, No.22 Finally they said, Who are you? Give us an answer to take back to those who sent us. What do you say about yourself?23 John replied in the words of Isaiah the prophet, I am the voice of one calling in the wilderness, Make straight the way for the Lord.24 Now the Pharisees who had been sent 25 questioned him, Why then do you baptize if you are not the Messiah, nor Elijah, nor the Prophet?26 I baptize with water, John replied, but among you stands one you do not know. 27 He is the one who comes after me, the straps of whose sandals I am not worthy to untie.28 This all happened at Bethany on the other side of the Jordan, where John was baptizing.John Testifies About Jesus29 The next day John saw Jesus coming toward him and said, Look, the Lamb of God, who takes away the sin of the world! 30 This is the one I meant when I said, A man who comes after me has surpassed me because he was before me. 31 I myself did not know him, but the reason I came baptizing with water was that he might be revealed to Israel.32 Then John gave this testimony: I saw the Spirit come down from heaven as a dove and remain on him. 33 And I myself did not know him, but the one who sent me to baptize with water told me, The man on whom you see the

Spirit come down and remain is the one who will baptize with the Holy Spirit. 34 I have seen and I testify that this is Gods Chosen One.Johns Disciples Follow Jesus35 The next day John was there again with two of his disciples. 36 When he saw Jesus passing by, he said, Look, the Lamb of God!37 When the two disciples heard him say this, they followed Jesus. 38 Turning around, Jesus saw them following and asked, What do you want?They said, Rabbi (which means Teacher), where are you staying?39 Come, he replied, and you will see.So they went and saw where he was staying, and they spent that day with him. It was about four in the afternoon.40 Andrew, Simon Peters brother, was one of the two who heard what John had said and who had followed Jesus. 41 The first thing Andrew did was to find his brother Simon and tell him, We have found the Messiah (that is, the Christ). 42 And he brought him to Jesus.Jesus looked at him and said, You are Simon son of John. You will be called Cephas (which, when translated, is Peter).Jesus Calls Philip and Nathanael43 The next day Jesus decided to leave for Galilee. Finding Philip, he said to him, Follow me.44 Philip, like Andrew and Peter, was from the town of Bethsaida. 45 Philip found Nathanael and told him, We have found the one Moses wrote about in the Law, and about whom the prophets also wroteJesus of Nazareth, the son of Joseph.46 Nazareth! Can anything good come from there? Nathanael asked.Come and see, said Philip.47 When Jesus saw Nathanael approaching, he said of him, Here truly is an Israelite in whom there is no deceit.48 How do you know me? Nathanael asked.Jesus answered, I saw you while you were still under the fig tree before Philip called you.49 Then Nathanael declared, Rabbi, you are the Son of God; you are the king of Israel.50 Jesus said, You believe because I told you I saw you under the fig tree. You will see greater things than that. 51 He then added, Very truly I tell you, you will see heaven open, and the angels of God ascending and descending on the Son of Man.

Goal: Your assignment is to write a C++program to read in a file of English text, and determine the length distribution of words in the text as well as count the occurrences of specific words. This assignment will allow you to practice working with arrays. ile Name:john1_niv.txt ount of words by length 1 chars 2 chars 3 chars 4 chars 5 chars 6 chars 7 chars 8 chars 9 chars 10 chars 11chars 12 chars 12 chars 25 145 342 185 120 61 60 25 28 2.5% 14.5% 34.2% 18.5% 12.0% 6.1% 6.0% 2.5% 2.8% 0.7% 0.1% 0.1% 0.0% Program Output The text for The Message translation of John 1 was copied into a file called "johnl niv.txt." Footnote references were removed. My solution to this assignment was run using this file. The following screenshot shows what your program should output when this file is specified. As you can see it has counted the number of words of each length, up to 12 characters long. It also counts the number of words that are over 12 characters long. It displays the corresponding percentage to the right of the actual count. In addition, it has counted the number of times two groups of specifie words occur, displaying both the counts and percentages. ount of God words ESUS CHRIST HOLY 1.2% 1.5% 0.2% 0.1% 0.3% Implementation using arrays: This lab assignment gives you the opportunity to practice using arrays. As you read through the words in the text., you will use one array (an "int" array of 12 elements) to count the number of words of each length, and you will use two sets of parallel arrays to count the number of occuirences of specific words PIRIT ount of article words 9 . 6% 0.2% 7.5% THE 75 Functions vou need to write: 1) A function that takes a string read from the file as a parameter, and returns a new string which contains no characters except letters of the alphabet, and with all letters converted to upper case functions defined in . But there is a small wrinkle. The test file was copied from the internet and it contains some 8-bit ASCII characters. If you call ectype> functions directly, you will get an assert. You should cast the char value to unsigned char first before passing to the function. Use static-cast. 2) A function that takes a count array and the number of elements in this array as parameters, and sets al array elements to zero 2) A function that takes a word, a count array, the number of elements in the array, anda reference parameter for the count of words with length longer than the size. This function will . NOTE: for this function you will want to use

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions