Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please do the following in Java Programming Language as a one Program: Sample.txt Call me Ishmael. Some years agonever mind how long preciselyhaving little or

Please do the following in Java Programming Language as a one Program:

image text in transcribed

Sample.txt

Call me Ishmael. Some years agonever mind how long preciselyhaving little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world. It is a way I have of driving off the spleen and regulating the circulation. Whenever I find myself growing grim about the mouth; whenever it is a damp, drizzly November in my soul; whenever I find myself involuntarily pausing before coffin warehouses, and bringing up the rear of every funeral I meet; and especially whenever my hypos get such an upper hand of me, that it requires a strong moral principle to prevent me from deliberately stepping into the street, and methodically knocking peoples hats offthen, I account it high time to get to sea as soon as I can. This is my substitute for pistol and ball. With a philosophical flourish Cato throws himself upon his sword; I quietly take to the ship. There is nothing surprising in this. If they but knew it, almost all men in their degree, some time or other, cherish very nearly the same feelings towards the ocean with me.

Using the String methods, Arrays methods, StringBuilder and Arraylist functionality we have discussed in class, perform the following operations on the text in the sample.txt file associated with this assignment (it is in the same place as this document). You should copy the text from that file into a String variable in your code. Your code should preform the following operations on the provided string and print the results to System.out 1. 2. 3. 4. 5. 6. 7. Provide the length of the text. Find the first location of the word "grim" Give the substring from index 199 to index 225 Find the number of occurrences of the word "whenever" Break the string into tokens using space as a delimiter, place the tokens in an array. Provide the count of the number of tokens. Reassemble the string in reverse order from the tokens in the array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions

Question

Discuss the challenges in scanning the environment.

Answered: 1 week ago

Question

Have issues been prioritized?

Answered: 1 week ago

Question

Has the priority order been provided by someone else?

Answered: 1 week ago

Question

Compare the current team to the ideal team.

Answered: 1 week ago