Question: Part 2 . Read & Write a File ( 3 pts ) In MyFile , implement a public static method called writePrimes that takes two
Part Read & Write a File pts
In MyFile implement a public static method called writePrimes that takes two Strings for two
filenames as parameters. The first file contains lines of words or integers separated by commas.
Read the first file, and write any prime numbers to the second file, each on a new line.
Additional requirements
Use trywithresource.
Use two Scanner objects: one scans the file line by line, the other scans each line word by word.
Has a separate method to check whether a word is a prime. The code should include minimum
number of iterations needed to return a result.
Example
Suppose the filename of the first file is file and heres its content:
panda,CShello,WOW
yes,no
Then after executing writePrimesfile "file; a file called file will be created and here
will be its content:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
