Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this is the text : This statistic shows the number of higher education institutions in the United States from 1980 to 2017. As can be
this is the text :
This statistic shows the number of higher education institutions in the United States from 1980 to 2017.
As can be seen in the graph, there were a total of 3803 higher education institutions across the United States as of 2015. In 2016, there were 331 higher education institutions in California, the highest number of any U.S. state. New York had the second most higher education institutions with 967, followed by Texas and Pennsylvania.
h
Objective In this lab, you will leam 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 extract 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. fle.but Source History 1 This statistic shows the number of higher education institutions in the United States from 1980 to 2017. As can be seen in the graph, there were a total of 4 3003 higher education institutions across the $ 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 o second most higher education institutions with 967, 9 followed by Texas and Pennsylvania Sie2.txt x XL Source History 2.33 1 1980 2017 3 43803 2015 2016 331 967 10 1 Page FACULTY OF COMPUTING INFORMATION TECHNOLOGY KINCARDUL // UNIVERSITY - FCIT Output x Debugger Console X 203_J63 rum) x Picked up JAVA OPTIONS: Xx1024 2017 3303 331 967 BUILD SUCCESSFUL (total time: 2 seconds) 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. 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 Print Writter classes exist in java.io.) package, You need to open input/output files for reading and writing using: File inputFile = new File("filel.txt"); File outputFile = 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 PrintNriter (outputFile); Scanner input1 = new Scanner (inputFilel); Use close() method after completing the process of reading and writing operations on the fileStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started