Question: Your job is to create a Java program that will create an array of integers to be sorted. You can use the Math.random() method to

Your job is to create a Java program that will create an array of integers to be sorted. You can use the Math.random() method to create a double in the range 0.0 to 1.0. You then scale this number so that it lies in the range 0 to Integer.MAX_VALUE, and then round it to the nearest integer. The user will be able to specify whether the array is filled with integers in random order, ascending order, or descending order(THROUGH COMMAND-LINE ARGUMENTS). The length of the array is arbitrary and will be specified at run time. The array may contain duplicate numbers. Your program will take this array and sort it into ascending, descending or random order, outputting the sorted list to a text file, one item per line. Has to take 4 command line arguments: order (1) is the order of the integers in the input array (use one of the following strings: ascending, descending, random), size (2) is the number of items in the integer array to be sorted, algorithm (3) specifies the sorting technique to use (use one of the following strings: merge, quick, insertion, selection), and outputfile (4) is the name of the output file where the sorted list will be written to. Your program will time how long it takes to sort the array. Be sure to time only the sorting function itself, and not the time taken to fill the array with numbers or do input or output. Your program will print the time in seconds to the screen (standard output). Please Do EVERYTHING asked properly!

** you fill the array with random numbers (preferable 0- 99), size/length of array is inputted by user (could be 10 - 100000), and then have the user input from command-line what order would they want it in...(random, descending (max to min) or acsending(min to max)) to sort it in desired way! This is everything given to me above!!**

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!