Question
(Write/read data) Write a program to create a file named Exercise12_15.txt if it does not exist. Write 100 integers created randomly into the file using
(Write/read data) Write a program to create a file named Exercise12_15.txt if it does not exist. Write 100 integers created randomly into the file using text I/O. Integers are separated by spaces in the file. Read the data back from the file and display the data in increasing order.
Following Modifications:
After writing the file to disk, the input file should be read into an array, sorted using the static Array.sort() method from the Java API and then displayed in the terminal window with each of the numbers on a separate line (maximum grade of 8 points if the sort is missing)
Sorting of arrays was covered in CST112 and in Chapter 6 of the textbook; you will receive up to 9 out of ten (10) points for this assignment if you read the input file into an array of 100 elements and sort the array using either a selection or insertion sort before writing the list of numbers to the terminal window
The maximum number of points for this assignment is 7 out of ten (10) if you simply write the input file to the terminal window without sorting the list
Step 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