我需要帮助我正在进行的项目,我需要制作一个钢琴程序,将按键存放在钢琴的钢琴中,然后按下播放按钮我需要它来播放调整了。我的代码在这里;任何帮助将不胜感激
import java.util.*;
import student.NoteStore;
/**
*
* @author Alex
*/
public class Notestore implements NoteStore {
ArrayList<Integer> tune = new ArrayList<>();
@Override
public void addNote(int note) {
tune.add(note);
}
public void getNextNote(int note) {
for (int i = 0; i < tune.size(); i++) {
tune.get(i);
}
}
@Override
public boolean hasNextNote() {
if ( == true) {
return true;
}
return false;
}
@Override
public void start(int sortOrder) {
NoteStore ns = new Notestore();
ns.addNote(60);
ns.addNote(62);
ns.addNote(58);
//start (with the notes in tune order)
ns.start(2);
int note1 = ns.getNextNote();
int note2 = ns.getNextNote();
//start again (with the notes in tune order)
ns.start(2);
int note3 = ns.getNextNote();
System.out.println("Notes were " + note1 + "," + note2 + "," + note3);
}
}