Create a reference class called equaltemperedfrequency have


JAVA ECLIPSE there are 2 classes in one package...first one is the method "EqualTemperedFrequency". 2nd one is PlayPianoScale...

Create a reference class called EqualTemperedFrequency. Have it implement the Comparable interface (see the first line of the Date class to see how to specify that). The class will contain a single double value that is a sound frequency. The API for the class should contain the following constructor and methods:

EqualTemperedFrequency(double initial): This constructor sets the the sound frequency of the object being created to the initial value supplied.
EqualTemperedFrequency next(): This returns an EqualTemperedFrequency object having the next higher frequency. Compute that next frequency by multiplying the frequency in this object by 2 raised to the 1/12 power. I suggest using the Math.pow method for this.
void play(double duration): This plays the frequency for the number of seconds specified by the duration parameter. Adapt the playNote method from group 1 for this method.
String toString(): This will return the frequency as a string. You might want to use the Double.toString() method.
int compareTo(EqualTemperedFrequency that): There are several ways to implement this method but however you do it, it must return -1 if this frequency is less than that frequency, 0 if they're equal, and 1 if this frequency is greater than that frequency.
boolean isLessThanOrEqual(EqualTemperedFrequency that): This returns true if this frequency is less than or equal to that frequency and false otherwise.
Make each of the above public.
Write a separate program that uses the EqualTemperedFrequency class to play the 88 frequencies of a piano. Call it PlayPianoScale. The lowest frequency a piano usually plays is 27.5.

Request for Solution File

Ask an Expert for Answer!!
Business Management: Create a reference class called equaltemperedfrequency have
Reference No:- TGS0981696

Expected delivery within 24 Hours