Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

these are the words that are in seperate file Write a Java program to perform some operations on the text file of the user's choice.

image text in transcribedimage text in transcribed

these are the words that are in seperate file

Write a Java program to perform some operations on the text file of the user's choice. Your program should first ask the user for their file name including the path and then present the user with the following menu of choices: Choose an item from the menu: 1. Count the number of words in the file. 2. Count the number of characters in the file. 3. Remove all occurrences of a word from the file. 4. Replace all occurrences of a word in the file with another word. For each of the menu choices, write a method to do the work: - The methods for the first 2 choices should be passed a string containing the properly formatted file path and file name for the file entered by the user. These first 2 methods should return an int representing the count so the count can be displayed to the console for the user by the calling method. - For the last two choices, the methods should be passed a string containing the properly formatted file path and file name for the file entered by the user. They should both be void methods that do their job by writing the resulting text after the operation to a new file. The new file should be named newfile.txt and stored in the same folder as the user's file after it is written. Make sure you ask the user the word they want to remove or replace. If replacing a word, the user should also be asked what word they want to replace the old word with. Note: I would recommend creating a simple folder under the root of c: \ to hold all your text files. attack at dawn bring the big guns do not back down we are counting on you

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

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

What is the primary focus of the independent t test?

Answered: 1 week ago

Question

=+d. Is there another print vehicle you would suggest?

Answered: 1 week ago

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago

Question

Define and measure service productivity.

Answered: 1 week ago