Create a program that is the equivalent of verbal flash cards to teach young chi
ID: 3665644 • Letter: C
Question
Create a program that is the equivalent of verbal flash cards to teach young children arithmetic. Your program
should randomly pick two one digit integers, for example, A and B, then using text to speech build a text
string that says something like “ How much is ” + A + “ plus “ + B +”?” (The question mark at the end will
affect the way the String is pronounced.) Your program should ask the user to enter an answer, then verbally
tell the student that it is right, or tell the student something like “Sorry, the answer is” + sum +”.” Your
program should give the use five different randomly generated problems, and should verbally tell the user
something like “you got” 4 out of 5 correct.” when the program ends. Your program should include a short
spoken greeting and intro at the beginning.
this program needs to use java freetts api
Explanation / Answer
private static final String VOICENAME="kevin16";
private void jButoon1ActionPerformed(java.awt.event.ActionEvent)
{
Voice voice;
voiceManager vm= VoiceManager.getInstance();
Random r = new Random();
voice = vm.getVoice(VOICENAME);
int a=r.nextInt();
int b=r.nextInt();
voice.allocate();
jTextField1.setText("How much is ” + a + “ plus “ + b +”?”);
try{
voice.speak(jTextField1.getText());
}
catch(Exception e)
{
}
Scanner scan=new Scanner(System.in);
int ans =scan.nextInt();
if(ans==(a+b))
jLabel1.setText("Right");
else
jLabel1.setText("Sorry, the answer is” + sum +”.” );
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.