Question: Write a complete Java program in a file called Module1Program.java that reads all the tokens from a file named data.txt that is to be found

Write a complete Java program in a file called Module1Program.java that reads all the tokens from a file named data.txt that is to be found in the same directory as the running program.

Write a complete Java program in a file called Module1Program.java that reads

all the tokens from a file named data.txt that is to be

Module 1 Program Write a complete Java program in a file called Module1Program.java that reads all the tokens from a file named data.txt that is to be found in the same directory as the running program. The program should ignore all tokens that cannot be read as an integer and read only the ones that can. After reading all of the integers, the program should print all the integers back to the screen, one per line, from the smallest to the largest. For example if data.txt contains 10 5five 10 1.5 2 2.0 20 Then your program should print to the screen 10 10 20 If the file does not exist, then your program should instead print "File not found" and exit. Your program should start by allocating an array of size 8 and fill it with the first 8 tokens. On the ninth token, it should replace the array with one of size 16 and copy all the integers already read. On the 17th token, it should replace the array with one of size 32 and copy all the integers already read. Etc. Since this doubling the size of an array is a repeated operation that is easily factored into a coherent chunk, you should write a method that performs this task

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!