ตามโค้ดนี้เลยค่ะ ไม่ error แต่เสียงไม่ดัง แก้ยังไงค่ะ หรือต้องตั้งค่าที่ไหน
import java.util.* ;
class Alfa {
private static Scanner X ;
public static void main(String [] args) {
SoundPlay t = new SoundPlay();
String input = " ";
String output = " ";
X = new Scanner(System.in);
System.out.print("input String : ") ;
input = X.next();
int n = input.length();
input = input.toLowerCase();
for (int i=0;i<n;i++) {
char select = input.charAt(i);
switch(select) {
case 'a' : output+="Alfa "; break;
case 'b' : output+="Bravo "; break;
case 'c' : output+="Charlie "; break;
case 'd' : output+="Delta "; break;
case 'e' : output+="Echo "; break;
case 'f' : output+="Foxtrot "; break;
case 'g' : output+="Golf "; break;
case 'h' : output+="Hotel "; break;
case 'i' : output+="India "; break;
case 'j' : output+="Juliett "; break;
case 'k' : output+="Kilo "; break;
case 'l' : output+="Lima "; break;
case 'm' : output+="Mike "; break;
case 'n' : output+="November "; break;
case 'o' : output+="Oscar "; break;
case 'p' : output+="Papa "; break;
case 'q' : output+="Quebec "; break;
case 'r' : output+="Romeo "; break;
case 's' : output+="Sierra "; break;
case 't' : output+="Tango "; break;
case 'u' : output+="Uniform "; break;
case 'v' : output+="Victor "; break;
case 'w' : output+="Whiskey "; break;
case 'x' : output+="Xray "; break;
case 'y' : output+="Yankee "; break;
case 'z' : output+="Zulu "; break;
case '1' : output+="One "; break;
case '2' : output+="Two "; break;
case '3' : output+="Three "; break;
case '4' : output+="Four "; break;
case '5' : output+="Five "; break;
case '6' : output+="Six "; break;
case '7' : output+="Seven "; break;
case '8' : output+="Eight "; break;
case '9' : output+="Nine "; break;
case '0' : output+="Zero "; break;
default : output = "\n"; }
} System.out.println("Output :"+output);
System.out.println("PlaySound :");
for (int i=0;i<n;i++) {
char select = input.charAt(i);
switch(select) {
case 'a' : t.run("/FFOutput/REC001.wav"); break;
case 'b' : t.run("E:/FFOutput/REC002.wav"); break;
case 'c' : t.run("E:/FFOutput/REC003.wav"); break;
case 'd' : t.run("E:/FFOutput/REC004.wav"); break;
case 'e' : t.run("E:/FFOutput/REC005.wav"); break;
case 'f' : t.run("E:/FFOutput/REC006.wav"); break;
case 'g' : t.run("E:/FFOutput/REC007.wav"); break;
case 'h' : t.run("E:/FFOutput/REC008.wav"); break;
case 'i' : t.run("E:/FFOutput/REC009.wav"); break;
case 'j' : t.run("E:/FFOutput/REC010.wav"); break;
case 'k' : t.run("E:/FFOutput/REC011.wav"); break;
case 'l' : t.run("E:/FFOutput/REC012.wav"); break;
case 'm' : t.run("E:/FFOutput/REC013.wav"); break;
case 'n' : t.run("E:/FFOutput/REC014.wav"); break;
case 'o' : t.run("E:/FFOutput/REC015.wav"); break;
case 'p' : t.run("E:/FFOutput/REC016.wav"); break;
case 'q' : t.run("E:/FFOutput/REC017.wav"); break;
case 'r' : t.run("E:/FFOutput/R.wav"); break;
case 's' : t.run("E:/FFOutput/REC018.wav"); break;
case 't' : t.run("E:/FFOutput/REC019.wav"); break;
case 'u' : t.run("E:/FFOutput/REC020.wav"); break;
case 'v' : t.run("E:/FFOutput/REC021.wav"); break;
case 'w' : t.run("E:/FFOutput/REC022.wav"); break;
case 'x' : t.run("E:/FFOutput/REC023.wav"); break;
case 'y' : t.run("E:/FFOutput/REC024.wav"); break;
case 'z' : t.run("E:/FFOutput/REC025.wav"); break;
case '1' : t.run("E:/FFOutput/REC026.wav"); break;
case '2' : t.run("E:/FFOutput/REC027.wav"); break;
case '3' : t.run("E:/FFOutput/REC028.wav"); break;
case '4' : t.run("E:/FFOutput/REC029.wav"); break;
case '5' : t.run("E:/FFOutput/REC030.wav"); break;
case '6' : t.run("E:/FFOutput/REC031.wav"); break;
case '7' : t.run("E:/FFOutput/REC032.wav"); break;
case '8' : t.run("E:/FFOutput/REC033.wav"); break;
case '9' : t.run("E:/FFOutput/REC034.wav"); break;
case '0' : t.run("E:/FFOutput/REC035.wav"); break;
}
}
}
}
แทรกเสียงใน java netbeans เสียงไม่ดัง ทำยังไงค่ะ
import java.util.* ;
class Alfa {
private static Scanner X ;
public static void main(String [] args) {
SoundPlay t = new SoundPlay();
String input = " ";
String output = " ";
X = new Scanner(System.in);
System.out.print("input String : ") ;
input = X.next();
int n = input.length();
input = input.toLowerCase();
for (int i=0;i<n;i++) {
char select = input.charAt(i);
switch(select) {
case 'a' : output+="Alfa "; break;
case 'b' : output+="Bravo "; break;
case 'c' : output+="Charlie "; break;
case 'd' : output+="Delta "; break;
case 'e' : output+="Echo "; break;
case 'f' : output+="Foxtrot "; break;
case 'g' : output+="Golf "; break;
case 'h' : output+="Hotel "; break;
case 'i' : output+="India "; break;
case 'j' : output+="Juliett "; break;
case 'k' : output+="Kilo "; break;
case 'l' : output+="Lima "; break;
case 'm' : output+="Mike "; break;
case 'n' : output+="November "; break;
case 'o' : output+="Oscar "; break;
case 'p' : output+="Papa "; break;
case 'q' : output+="Quebec "; break;
case 'r' : output+="Romeo "; break;
case 's' : output+="Sierra "; break;
case 't' : output+="Tango "; break;
case 'u' : output+="Uniform "; break;
case 'v' : output+="Victor "; break;
case 'w' : output+="Whiskey "; break;
case 'x' : output+="Xray "; break;
case 'y' : output+="Yankee "; break;
case 'z' : output+="Zulu "; break;
case '1' : output+="One "; break;
case '2' : output+="Two "; break;
case '3' : output+="Three "; break;
case '4' : output+="Four "; break;
case '5' : output+="Five "; break;
case '6' : output+="Six "; break;
case '7' : output+="Seven "; break;
case '8' : output+="Eight "; break;
case '9' : output+="Nine "; break;
case '0' : output+="Zero "; break;
default : output = "\n"; }
} System.out.println("Output :"+output);
System.out.println("PlaySound :");
for (int i=0;i<n;i++) {
char select = input.charAt(i);
switch(select) {
case 'a' : t.run("/FFOutput/REC001.wav"); break;
case 'b' : t.run("E:/FFOutput/REC002.wav"); break;
case 'c' : t.run("E:/FFOutput/REC003.wav"); break;
case 'd' : t.run("E:/FFOutput/REC004.wav"); break;
case 'e' : t.run("E:/FFOutput/REC005.wav"); break;
case 'f' : t.run("E:/FFOutput/REC006.wav"); break;
case 'g' : t.run("E:/FFOutput/REC007.wav"); break;
case 'h' : t.run("E:/FFOutput/REC008.wav"); break;
case 'i' : t.run("E:/FFOutput/REC009.wav"); break;
case 'j' : t.run("E:/FFOutput/REC010.wav"); break;
case 'k' : t.run("E:/FFOutput/REC011.wav"); break;
case 'l' : t.run("E:/FFOutput/REC012.wav"); break;
case 'm' : t.run("E:/FFOutput/REC013.wav"); break;
case 'n' : t.run("E:/FFOutput/REC014.wav"); break;
case 'o' : t.run("E:/FFOutput/REC015.wav"); break;
case 'p' : t.run("E:/FFOutput/REC016.wav"); break;
case 'q' : t.run("E:/FFOutput/REC017.wav"); break;
case 'r' : t.run("E:/FFOutput/R.wav"); break;
case 's' : t.run("E:/FFOutput/REC018.wav"); break;
case 't' : t.run("E:/FFOutput/REC019.wav"); break;
case 'u' : t.run("E:/FFOutput/REC020.wav"); break;
case 'v' : t.run("E:/FFOutput/REC021.wav"); break;
case 'w' : t.run("E:/FFOutput/REC022.wav"); break;
case 'x' : t.run("E:/FFOutput/REC023.wav"); break;
case 'y' : t.run("E:/FFOutput/REC024.wav"); break;
case 'z' : t.run("E:/FFOutput/REC025.wav"); break;
case '1' : t.run("E:/FFOutput/REC026.wav"); break;
case '2' : t.run("E:/FFOutput/REC027.wav"); break;
case '3' : t.run("E:/FFOutput/REC028.wav"); break;
case '4' : t.run("E:/FFOutput/REC029.wav"); break;
case '5' : t.run("E:/FFOutput/REC030.wav"); break;
case '6' : t.run("E:/FFOutput/REC031.wav"); break;
case '7' : t.run("E:/FFOutput/REC032.wav"); break;
case '8' : t.run("E:/FFOutput/REC033.wav"); break;
case '9' : t.run("E:/FFOutput/REC034.wav"); break;
case '0' : t.run("E:/FFOutput/REC035.wav"); break;
}
}
}
}