Module hw06

Class ABCInstrument

java.lang.Object
provided.abcMusic.utils.ABCInstrument

public class ABCInstrument extends Object
Represents an instrument as a name and an integer value
Author:
swong
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private String
    The name of the instrument
    private int
    The integer value associated with the instrument.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ABCInstrument​(String name, int value)
    Constructor for the class
  • Method Summary

    Modifier and Type
    Method
    Description
    Accessor for the name of the instrument
    int
    Accessor for the integer value associated with this instrument.
    Returns the string representation of this class

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • name

      private String name
      The name of the instrument
    • value

      private int value
      The integer value associated with the instrument.
  • Constructor Details

    • ABCInstrument

      public ABCInstrument(String name, int value)
      Constructor for the class
      Parameters:
      name - the name of the instrument
      value - the instrument's associated integer value
  • Method Details

    • getName

      public String getName()
      Accessor for the name of the instrument
      Returns:
      the name of the instrument
    • getValue

      public int getValue()
      Accessor for the integer value associated with this instrument.
      Returns:
      the integer value for this instrument
    • toString

      public String toString()
      Returns the string representation of this class
      Overrides:
      toString in class Object
      Returns:
      "name: value"