Write a Java class named aMergeSortDoubles.java that accepts an integer command line argument Use that integer argument
Fantastic news! We've Found the answer you've been seeking!
Question:
- Write a Java class namedaMergeSortDoubles.javathat accepts an integer command line argument
- Use that integer argument to create an array of Doubles (use the Wrapper class)
- Initialize the array with double values in the range of the length of the array
- For example, if the array length is 10, each value can be 1.0-10.0
- Use a loop to display each random value of the array, labeled as "Random array..."
- Use a row of hyphens "----------------------" to separate the label from output
- Since doubles can be long, consider using println() to put a value on each line rather than only print()
- Use theMerge.sort(array)method to sort the values in the array
Use a loop to display each sorted value of the array, labeled as "Merge-sorted array..."
- Use a row of hyphens "----------------------" to separate the label from output
- Since doubles can be long, consider using println() to put a value on each line rather than only print()
- Run the program at least three times, each with a different value for the array length, then copy and paste the results into an output file. See follow-up question for submitting the OUTPUT file.
- Here is a sample run:
- java-algs4 aMergeSortDoubles 3
- Random array...
- ------
- 1.2633458343451707
- 0.4002266109760163
- 0.1365140849236074
- Merge-sorted array...
- ------
- 0.1365140849236074
- 0.4002266109760163
- 1.2633458343451707
Related Book For
Posted Date: