Question: Code in Java Implement another enumeration, Beat.java to represent the duration of a note: Beat WHOLE THREEQUARTER HALF THREEEIGHTH QUARTER THREESIXTEENTH EIGHTH SIXTEENTH getBeats(): double

Code in Java

Code in Java Implement another enumeration, Beat.java to represent the duration of

Implement another enumeration, Beat.java to represent the duration of a note: Beat WHOLE THREEQUARTER HALF THREEEIGHTH QUARTER THREESIXTEENTH EIGHTH SIXTEENTH getBeats(): double getDuration(int): double toString0 : String Assuming the music is in standard time, a quarter note plays for a duration of 1 beat. The other beats are defined predictably in terms of the quarter note: Beats Value WHOLE THREEQUARTER HALF THREEEIGHTH QUARTER THREESIXTEENTH EIGHTH SIXTEENTH 1 3/4 1/2 1/4 | The getBeats() method simply returns the values from the above table. The method getDuration calculates the time, in seconds, that the note should be played given a tempo in units of beats per minute. The input says how many quarter notes can be played in 60 seconds, and the output is the number of seconds it takes to play the beat ((60.0 * beats) / tempo). The toString() method prints the fraction of a WHOLE note that the beat represents, wrapped in parentheses. For example, Beat. WHOLE.toString() returns " (1) ", Beat . QUARTER.toString() returns" (1/4)", and Beat. THREESIXTEENTH.toString() returns" (3/16)". Again, you can add private attributes to the enumeration to make the method easier to define

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!