Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.HashMap;
- public class BlackOrWhiteKey {
- public static String blackOrWhiteKey(int keyPressCount) {
- HashMap<Integer, String> keynotesColor = new HashMap<Integer, String>();
- keynotesColor.put(1, "white");
- keynotesColor.put(2, "black");
- int a = 0;
- int b = 3;
- while (a < 7) {
- keynotesColor.put(b, "white");
- b++;
- keynotesColor.put(b, "white");
- b++;
- keynotesColor.put(b, "black");
- b++;
- keynotesColor.put(b, "white");
- b++;
- keynotesColor.put(b, "black");
- b++;
- keynotesColor.put(b, "white");
- b++;
- keynotesColor.put(b, "white");
- b++;
- keynotesColor.put(b, "black");
- b++;
- keynotesColor.put(b, "white");
- b++;
- keynotesColor.put(b, "black");
- b++;
- keynotesColor.put(b, "white");
- b++;
- keynotesColor.put(b, "black");
- b++;
- a++;
- }
- keynotesColor.put(b, "white");
- keynotesColor.put(b+1, "white");
- while (keyPressCount>88) {
- keyPressCount -= 88;
- }
- return keynotesColor.get(keyPressCount);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement