A. Create a new class RandomDouble (RandomDouble.java), which implements the interface Comparable. Your class must implement at least: - a no-arguments constructor which assigns a random double (from...

A. Create a new class RandomDouble (RandomDouble.java), which implements the interface Comparable. Your class must implement at least:



- a no-arguments constructor which assigns a random double (from Math.random) to a private instance variable.


- a toString method which returns a string representation of the random double.


- a compareTo method as required by the Comparable interface.


- a get method that returns the random double. This method must return a value of type double.


- a main method that creates and fills an array of 10 values of type RandomDouble, then sorts them using Arrays.sort, and finally prints the contents of the sorted array. The exact format for printing the array is up to you, as long as all the values are printed in the order in which they appear in the sorted array.


To get full score for this question, your RandomDouble.java must be in the package edu.hawaii.manoa.fall2020.ics111 . If you can't get the package working, comment out the package declaration, and you'll only lose one point.







May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here