Object Oriented

Programming Module

In this assignment, you need to implement a beat creating tool. The check boxes on each row represent equal time sections. If a box is checked, the instrument should be played at that specific time. You will need to create at least two objects to do the assignment:

  1. An Instrument object which has:
    • String that holds the name of the file to be played with the playFile() method.
    • An array of booleans to hold the values of the check boxes row. (checked = true, unchecked = false).
  2. A Beat object that has:
    • Instrument objects
    • Integer that represents how many time the beat should be played.
    • Integer waitTime that specifies how many milliseconds to wait between the played beats. It will be used by wait(milliseconds) method.

You are given:

  1. A user interface that contains a play button, a table of check boxes, and the following methods:
    • UIManager(Main m,int rows,int columns); creates a user interface with "rows" number of instruments and "columns" number of check boxes for each.
    • boolean[][] getArrayofCheckBoxes(); returns a two dimensional array that holds the current values of the check boxes.
    • void setLabels(String[] newLabels); changes the labels on the UI to the strings in the array newLabels.
  2. Several instrument sounds that you may use that are located in the "res" folder.
  3. Sound Manager class that helps you play the sound files using the playFile(String filename) method, and it also has wait(milliseconds) method.
  4. Skeleton code in the Main.java file that has booleans that hold the values of the check boxes, and the titles of the instruments in the user interface.