Question: Write a Java class named aMergeSortDoubles.java that accepts an integer command line argument Use that integer argument to create an array of Doubles (use the
- 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
