// represents general abstract elements of musical instruments public abstract class MusicalInstrument { protected String key; /* constructors -----------------------------------------*/ public MusicalInstrument() { key = "C"; } /* constructor with parameter */ public MusicalInstrument(String newKey) { this(); setKey(newKey); } /* mutators and accessors for instance variables -------*/ public void setKey(String newKey) { key = newKey; } public String getKey() { return key; } /* abstract methods ---------------------------------*/ public abstract void play(); public abstract void prepare(); /* toString create String representation */ public String toString() { return "("+key+")"; } }