In this assignment you will design a very simple abstract data type.
This assignment must be submitted to the Moodle submission page for Homework 2 with the name Note.java by 11:00 PM on Thursday, 26 January.
Find a computer where you can run Java programs under NetBeans. Hopefully, it will be one you use at home.
Your program must be written for the
homework2
package.
Use the Java class TestDriver
to test your class.
Implement an ADT with a Java class name Note
in the package homework2
to represent musical notes. For this assignment
the notes are going to
consist of three pieces of information.
'A'
to 'G'
'f'
, ' '
, or
's'
For this first assignment, we are going to take it easy and allow and character to be used an a letter or an accidental and any integer to be used as an octave.
Make all the fields of your ADT private. Make sure that it provides the following accessor methods.
getLetter
getAccidental
getOctave
Make sure it contains the following mutator methods.
setLetter
setAccidental
setOctave
Your ADT implementation should contain two constructors.
One constructor should take three arguments, corresonding to
the letter, accidental, and octave, in order.
The second constructor should take no arguments and create an
object having the letter 'C'
,
the accidental ' '
,
and the octave 4
.