Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem 3 (Files): In the same package, create another Java class and call it Problem_3. Solve the following problems: 1. A Java method to determine

image text in transcribed
Problem 3 (Files): In the same package, create another Java class and call it Problem_3. Solve the following problems: 1. A Java method to determine and return the number of times a word is present in a file, where the filename and word is received as parameters. The header of the method is as follows: public static int countWordsInFile(String filename, String word) 2. Create an input file and add some words in it. Then test your method by searching for any word in that file. Test twice, once with a word that is found, and another time with a word that is not found. 3. A Java method to count and return the number of lines, words, and characters in an input file (Do not count spaces as characters). It returns the required information in an array of integers. public int[] fileInfo (String filename) 4. Use the same input file you created in the previous question and output the number of lines, words, and characters in that file. When 5. A Java method to convert words in a file into all capital letters and writes the output to an output file. The header of the method takes the input file name and the output file name: public void convert (String inputFileName, String outputFileName) 6. Test your method in the main method using the same input file you created. Use a different file name as your output file

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

More Books

Students also viewed these Databases questions