Specify, design, and implement a class that can be used to hold information about a musical note.

Question:

Specify, design, and implement a class that can be used to hold information about a musical note. A programmer should be able to set and retrieve the length of the note and the value of the note. The length of a note may be a sixteenth note, eighth note, quarter note, half note, or whole note. A value is specified by indicating how far the note lies above or below the A note that orchestras use in tuning. In counting “how far,” you should include both the white and black notes on a piano. For example, the note numbers for the octave beginning at middle C are shown

-8 -6 -3 -1 1 C# D# F* G* A* I3D Note пиmbers for the octave of cToTE FTa CD FG|AB middle C -9 -7 -5 -4 -2 0 2

The constructor should set a note to a middle C quarter note. Include methods to set a note to a specified length and value. Write methods to retrieve information about a note, including methods to tell you the letter of the note (A, B, C, etc.), whether the note is natural or sharp (i.e., white or black on the piano), and the frequency of the note in hertz. To calculate the frequency, use the formula 440 × 2n/12, where n is the note number. Feel free to include other useful methods.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: