QUESTION 3: PROGRAMMING WITH FILES Write a main method and a complete static method named printRepeat that work together as described here. Include pseudo code to show how you planned to do the work. main should prompt the user using a Scanner170 object to ask for a single letter between a and z (lower case) from the keyboard input; if the user enters anything else reprompt until they enter a proper input. Main also creates a second Scanner170 object to read from a file called repeat.txt (provided with the exam). Finally, main calls the printRepsat method with the second Scanner170 and the input letter and prints out the value returned from printRepeat. RrintRepeat takes as parameters a Scanner170 object and a one letter long String, it returns a int. The method reads lines of text from the Scanner170 object it received as a parameter. Each line read consists of a number and a string (separated by at least one blank). The method should work with any number of lines in the Scanner170 object (including zero). For each line read, the method prints out to the user ">>: “ followed by the string from the file duplicated number of times on a single line. The string read from the file may contain any symbols including special characters and numbers. The method also checks to see if the string from the file contains the letter it was given as second parameter. Keep count of how many lines in the file have letter included in their string. When the entire file has been processed, retun that count to the calling program. A sample input text file, repeat.txt is provided. Put it into Intellij in your VM at the project level for easy access. Be sure main and all methods include clear pseudo code to show your plan. See example output below (the results depend on what letter the user enters for matching): *** Use proper programming style and test your code until you believe it works correctly *** Example run produces something like this: Enter a single letter for me to watch for in the file: e >>: AppleAppleApple >>: 4x44x44x44x4 >>: >>: alone >: betterbetter printRepeat processed the file and returned: 3 For the input file:

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter3: Using Methods, Classes, And Objects
Section: Chapter Questions
Problem 1CP
icon
Related questions
Question
В Аpple
4 4x4
QUESTION 3: PROGRAMMING WITH FILES
O Nothing
Write a main method and a complete static method named printRepeat that work
1 alone
together as described here. Include pseudo code to show how you planned to do the work.
2 better
main should prompt the user using a Scanner170 object to ask for a single letter between a and z
(lower case) from the keyboard input; if the user enters anything else reprompt until they enter a proper
input. Main also creates a second Scanner170 object to read from a file called repeat.txt (provided
with the exam). Finally, main calls the printRepeat method with the second Scanner170 and the input
letter and prints out the value returned from printRepeat.
printRepeat takes as parameters a Scanner170 object and a one letter long String, it returns a
int. The method reads lines of text from the Scanner170 object it received as a parameter. Each line
read consists of a number and a string (separated by at least one blank). The method should work
with any number of lines in the Scanner170 object (including zero). For each line read, the method
prints out to the user ">>: “ followed by the string from the file duplicated number of times on a
single line. The string read from the file may contain any symbols including special characters and
numbers. The method also checks to see if the string from the file contains the letter it was given as
second parameter. Keep count of how many lines in the file have letter included in their string. When
the entire file has been processed, return that count to the calling program.
A sample input text file, repeat.txt is provided. Put it into Intellij in your VM at the project level
for easy access.
Be sure main and all methods include clear pseudo code to show your plan.
See example output below (the results depend on what letter the user enters for matching):
*** Use proper programming style and test your code until you believe it works correctly ***
Example run produces something like this:
...
Enter a single letter for me to watch for in the file:
e
>>: AppleAppleApple
>>: 4x44x44x44x4
>>:
>>: alone
>>: betterbetter
printRepeat processed the file and returned: 3
For the input file:
Transcribed Image Text:В Аpple 4 4x4 QUESTION 3: PROGRAMMING WITH FILES O Nothing Write a main method and a complete static method named printRepeat that work 1 alone together as described here. Include pseudo code to show how you planned to do the work. 2 better main should prompt the user using a Scanner170 object to ask for a single letter between a and z (lower case) from the keyboard input; if the user enters anything else reprompt until they enter a proper input. Main also creates a second Scanner170 object to read from a file called repeat.txt (provided with the exam). Finally, main calls the printRepeat method with the second Scanner170 and the input letter and prints out the value returned from printRepeat. printRepeat takes as parameters a Scanner170 object and a one letter long String, it returns a int. The method reads lines of text from the Scanner170 object it received as a parameter. Each line read consists of a number and a string (separated by at least one blank). The method should work with any number of lines in the Scanner170 object (including zero). For each line read, the method prints out to the user ">>: “ followed by the string from the file duplicated number of times on a single line. The string read from the file may contain any symbols including special characters and numbers. The method also checks to see if the string from the file contains the letter it was given as second parameter. Keep count of how many lines in the file have letter included in their string. When the entire file has been processed, return that count to the calling program. A sample input text file, repeat.txt is provided. Put it into Intellij in your VM at the project level for easy access. Be sure main and all methods include clear pseudo code to show your plan. See example output below (the results depend on what letter the user enters for matching): *** Use proper programming style and test your code until you believe it works correctly *** Example run produces something like this: ... Enter a single letter for me to watch for in the file: e >>: AppleAppleApple >>: 4x44x44x44x4 >>: >>: alone >>: betterbetter printRepeat processed the file and returned: 3 For the input file:
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT