Hey guys I am new to
java and would like to know how to start this off:
this is what i have so far
~~
public class Notes
{
private double middleC;
private double[] frequency = new double[13];
private
String[] notes = new String[]{"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C'"};
~~
All help is appreciated, thanks!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Homework~~~~~~~~~~~~~~~~~~~~~~~~~~
The programme will calculate the frequencies of a musical scale based on middle C.
Procedure:
Write two classes named: Notes and UseNotes.
The IO.java static class can be used for keyboard and display.
Arrays will be used to store doubles and Strings.
All files will be in a package called notes.
Also from command line in directory src compile and run
Notes:
a private double variable for middle C
a private array of doubles for 13 note frequencies or semitones
a private array of Strings for the note names C C# D D# E F F# G G# A A# B C'
a default constructor to set middle C to 260 Hz.
a constructor taking one double value to initialize middle C.
Setters for middle C and getters for the arrays
a calculate method to find the 13 semitones. When is the appropriate time for this method to be called?
a display method to show note names and frequency in 2 columns
a linear search function to retrieve a particular note frequency by the name which can be entered in upper or lower case. Prompt if not found, go again.
Calculation note: Each semitone is 2 to the power of 1/12 higher than the previous one.
So if C = 256, C# = 256 * 2 1/12
Use the Math class power function for this and find all 13 notes.
C' should be twice the frequency of C. This is called an Octave due to the 8 white keys in the musical scale. An Octave is a frequency ratio of 2 to one.
. Limit the input for middle C from 250 Hz to 270 Hz
UseNotes:
1. This class will have the main function. It will create a Notes object and print out the initial values of the 13 notes.
2. It will ask for a new value of middle C and print a new scale.
3. It will ask for the name of a particular note and then print it and its frequency. It will prompt for a new name if a bad note name is entered.
4. It will offer a choice to continue or exit.