Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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