到目前为止,我计划在城市公交车上模拟CAD系统。我处于它的开始阶段,这只是为了基本上创造声音。我此时没有创建语音对象的经验。我的问题是,我如何创建一个语音对象来读取以下消息?
import java.util.*;
import java.io.*;
public class message {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
String message = "";
System.out.print("Please enter a number between 1 through 5");
int num = input.nextInt();
if (num == 1)
message = "Please do not use profanity on the bus";
if (num == 2)
message = "Help us get you there faster. If able, please use the rear exit";
if (num == 3)
message = "Please remember, seats are not for feet.";
if (num == 4)
message = "Thank you for using headphones, also please keep your cell phone conversations quiet.";
if (num == 5)
message = "Please do not speak with the driver while the bus is moving.";
System.out.println(message);
}
}
到目前为止,我把它设置为在LED显示屏上打印,我试图弄清楚如何将语音合并到这个系统中,以便在我选择一个消息时说出消息。任何帮助将不胜感激。