import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.util.ArrayList;
public class Ipods {
int volume = 0;
boolean power = false;
boolean playing = false;
ArrayList<String> playlist = new ArrayList<>();
static int i = 0;
final int MIN_VOLUME = 0;
final int MAX_VOLUME = 10;
void power() {
power = !power;
System.out.println(power ? " ๐ ๐๐ผ๐โ๐๐๐ผ ๐"
: " SฬถTฬถAฬถNฬถDฬถ ฬถBฬถY");
}
void playing() {
if (power) {
playing = !playing;
System.out.println(playing ? "โถ playing : " + playlist.get(i)
: "โธ๏ธ pause " + playlist.get(i));
}
}
void status() {
if (power) {
if (playlist.size() > 0) {
System.out.println("๐๐ค๐ฌ ๐ฅ๐ก๐๐ฎ๐๐ฃ๐ ฤฑlฤฑ.lฤฑllฤฑlฤฑ.ฤฑllฤฑ. "
+ playlist.get(i));
} else if (playlist.size() == 0) {
System.out.println("Please add songs to your IPods");
}
}
}
void volumeUp() {
if (power) {
if (volume < MAX_VOLUME) {
volume++;
}
Volume();
}
}
void volumeDown() {
if (power) {
if (MIN_VOLUME < volume) {
volume--;
}
Volume();
}
}
void Volume() {
System.out.print(" ๐๐ค๐ก๐ช๐ข๐\t");
for (int i = MIN_VOLUME + 1; i <= MAX_VOLUME; i++) {
if (i <= volume) {
System.out.print("โฎ");
} else {
System.out.print("โฏ");
}
}
System.out.println();
}
void add_playlist(String a) {
if (power) {
playlist.add(playlist.size() - i, a);
System.out.println("\"" + a + "\" ๊ฐ ์ฌ์๋ชฉ๋ก์ ์ถ๊ฐ๋์์ต๋๋ค.");
}
}
void remove_playlist() {
if (power) {
if (playlist.size() > 0) {
System.out.println("\"" + playlist.get(i)
+ "\" ๊ฐ ์ฌ์๋ชฉ๋ก์์ ์ญ์ ๋์์ต๋๋ค.");
playlist.remove(i + 1);
} else {
System.out.println("์ฌ์๋ชฉ๋ก์ด ์กด์ฌํ์ง ์์ต๋๋ค.");
}
}
}
void playlist() {
if (power) {
System.out.println("\t๐๐ก๐จ๐ฅ๐ ๐๐ฅ๐๐ฒ๐ฅ๐ข๐ฌ๐ญ");
if (playlist.size() > 0) {
System.out.println("๐ฒ๐จ๐ฎ๐ซ ๐๐ฅ๐๐ฒ๐ฅ๐ข๐ฌ๐ญ : "
+ playlist.toString());
} else {
System.out.println("ํ๋ ์ด๋ฆฌ์คํธ๊ฐ ๋น์ด์์ต๋๋ค. ๊ณก์ ์ถ๊ฐํด์ฃผ์ธ์.");
}
}
}
void skips_song() {
if (power) {
i++;
if (i > playlist.size() - 1) {
i = i - playlist.size();
}
System.out.println("โฉ skip to : " + playlist.get(i));
}
}
void previous_song() {
if (power) {
i--;
if (i < 0) {
i = playlist.size() + i;
}
System.out.println("โช previous : " + playlist.get(i));
}
}
static int arrow;
public class Kevent extends KeyAdapter {
public void keyPressed(KeyEvent e) {
arrow = e.getKeyCode();
}
}
public static void main(String[] args) {
Ipods ip = new Ipods();
System.out.println(" ๐ ๐ฉ๐๐ ๐๐๐ฉ๐ง๐ค ๐๐๐ค๐ ๐");
while (true) {
System.out.println("7. ๐ฑ\t8. ๐\t9. ๐ด\t+");
System.out.println("4. โช\t5. โฏ๏ธ\t6. โฉ ");
System.out.println("1. ๐ถ\t2. ๐\t0. exit\t-");
String button = ScanUtil.nextLine();
switch (button) {
case "1":
ip.playlist();
break;
case "2":
ip.volumeDown();
break;
case "4":
ip.previous_song();
break;
case "5":
ip.playing();
break;
case "6":
ip.skips_song();
break;
case "7":
ip.status();
break;
case "8":
ip.volumeUp();
break;
case "9":
ip.power();
break;
case "+":
System.out.println("์ถ๊ฐํ ๊ณก์ ์
๋ ฅํด์ฃผ์ธ์.");
String song = ScanUtil.nextLine();
ip.add_playlist(song);
break;
case "-":
System.out.println("ํ์ฌ ๊ณก์ ์ญ์ ํฉ๋๋ค.");
ip.remove_playlist();
break;
case "0":
System.out.println(" ๐ ๐๐ผ๐ผ ๐๐๐ ๐");
System.exit(0);
}
}
}
}