Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Here I have shakespeare.text : Shall I compare thee to a summer's day? Thou art more lovely and more temperate: Rough winds do shake the
Here I have shakespeare.text :
Shall I compare thee to a summer's day? Thou art more lovely and more temperate: Rough winds do shake the darling buds of May, And summer's lease hath all too short a date; Sometimes too hot the eye of heaven shines, And often is his gold complexion dimm'd; And every fair from fair sometimes declines, By chance or nature's changing course untrimm'd: But thy eternal sumemr shall not fade Nor lose possession of that fair thou ow'st; Nor shall Death brag thou wand'rest in his shade, When in eternal lines to time thou grow'st; So long as men can breathe or eyes can see, So long lives this, and this gives life to thee.
And this is frost.txt:
Two roads diverged in a yellow wood, And sorry I could not travel both And be one traveler, long I stood And looked down one as far as I could To where it bent in the undergrowth; Then took the other, as just as fair, And having perhaps the better claim, Because it was grassy and wanted wear; Though as for that the passing there Had worn them really about the same, And both that morning equally lay In leaves no step had trodden black. Oh, I kept the first for another day! Yet knowing how way leads on to way, I doubted if I should ever come back. I shall be telling this with a sigh Somewhere ages and ages hence: Two roads diverged in a wood, and I- I took the one less traveled by, And that has made all the difference.1. Event Controlled Loops [2pt] String Statistics- Word processors usually have the ability to tell you how many words and how many lines are in your document. Write a program that asks the user for a name of a text file, and outputs the number of words in the textfile and the number of lines ( whitespaces (no tabs either) between words, only single whitespace. We will count words by reading each entire line in the input file as a String, and then using a new user class, StringStats (see below), to count the words in the String
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started