Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help with this question in Java. I know you wont have the file, but I would appreciate instructions or sample code to assist me.

image text in transcribedNeed help with this question in Java.

I know you wont have the file, but I would appreciate instructions or sample code to assist me.

Thank you

Write a program that prompts the user to enter a file name (use a JFileChooser). The program outputs to the screen the number of lines, words and characters in the file (that you collected with the JFileChooser) to an output file (hard-coded) called FileStats.txt AND to the screen. Also prompt the user to enter a string to search for in the file. In your output, state how many lines contained the requested string and display the lines and their line number. As with all assignments, do this one piece at a time. Test often and don't try to do it all at once. Try having the output go only to the screen first, and when that's working, send it to the output file (FileStats.txt) as well. Enter input file name: text1.txt Enter a string to search for: and 33 lines 159 words 810 characters. Your requested word - and - was found 8 times. 6: And what to do and how to be 10: But there in the sandpile at Sunday school. 21: Wash your hands before you eat. 23: Warm cookies and cold milk are good for you. 25: Learn some and think some 26: And draw and paint and sing and dance 27: And play and work every day some. 31: Hold hands and stick together

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

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

Recommended Textbook for

Principles Of Multimedia Database Systems

Authors: V.S. Subrahmanian

1st Edition

1558604669, 978-1558604667

More Books

Students also viewed these Databases questions

Question

What is linear transformation? Define with example

Answered: 1 week ago

Question

2. Identify issues/causes for the apparent conflict.

Answered: 1 week ago