Question: Can u plz help me with this assignment in java, I would like if can add comments in your code so I can understand the


Can u plz help me with this assignment in java, I would like if can add comments in your code so I can understand the code and the idea of the program
Objective In this lab, you will learn how to: File Processing using the File class Discovering file/directory properties, to using the File class Read /write data from/to a file using the Scanner/Print Writer class. Activity Description Create a java application called FileIOExample. The application should read contents from first file and extrac only numbers from it and write those numbers to the second file. Then the application should then read all numbers from the second file and display only the prime numbers to the terminal. There are two files used in this program, first file "filel.txt" containing text and digits and another file "file2.txt" to write only the extracted numbers from the first file. file 1.txt X Source History I E 1 This statistic shows the number of higher education 2 institutions in the United States from 1980 to 2017. 3 As can be seen in the graph, there were a total of 4 3803 higher education institutions across the 5 United States as of 2015. In 2016, there were 331 6 higher education institutions in California, the 7 highest number of any U.s. state. New York had the 8 second most higher education institutions with 967, 9 followed by Texas and Pennsylvania. file 2. txt X Source History 1 1980 2017 2. 3 4 3803 5 2015 2016 331 6 7 967 8 9 10 FCIT KAU Output x Debugger Console X cpcs 203_lab3 (run) x run: Picked up _JAVA_OPTIONS: -Xmx1024m 2017 3803 331 967 BUILD SUCCESSFUL (total time: 2 seconds) 1 When finished, make sure that the data written to the new file has been flushed from its buffer and that any system resources used during for running your code have been released. u Note Check the input file existence before start reading from the input files, if the file does not exist, display a message then exit the program execution. Hints: The File and PrintWritter classes: exist in (java.io. *) package. You need to open input/output files for reading and writing using: File inputFile = new File("file1.txt"); File output File = new File("file2.txt"); File inputFilel = new File("file2.txt"); Make Scanner variable to read from input file and make Printwriter variable to write to output file using: Scanner input = new Scanner (inputFile); PrintWriter output = new Printwriter (outputFile); Scanner inputi = new Scanner (inputFilel); Use close() method after completing the process of reading and writing operations on the file
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
