Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to write a Java program using Visual Studio 2010 that allows a user to in

ID: 3637042 • Letter: I

Question


I need to write a Java program using Visual Studio 2010 that allows a user to input a word (optional: and also searches for words in the dictionary , English language, etc… that equals exactly 100 based on the rule) , then the programs calculates the value of the inputted word based on the rule:

A=1 cent, B=2 cents, C=3 cents.....Z=26 cents.


The goal is to find inputted words that equal exactly 100 (optional: and also searches for  words in the dictionary that equal exactly 100 ) based on  the rule:

 A=1 cent, B=2 cents, C=3 cents.....Z=26 cents

I have created a form that has a textbox for the inputted word by the user, a calculate button, a clear button, a exit button, a search button to search words in the English Language, dictionary, etc… and a label to display the inputted word by the user and the value of the word, and a listbox to show words from the dictionary in alphabetically order that equal 100, another label displaying : This Word Is Equal to One Hundred!
My partially completed code is as follows:

[code]

Public Class MainForm

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub exitButton_Click(sender As Object, e As System.EventArgs) Handles exitButton.Click
Me.Close()

End Sub

Private Sub calcButton_Click(sender As Object, e As System.EventArgs) Handles calcButton.Click

     ' calculate and display the word

     ' declare variables
Dim inputWord As String
Dim calculatedInputWord As String
Dim char as


    ' assign user input to variables
inputWord =


calculatedInputWord =

     ' performs calculations


      ' calculate and display the inputted word

calculatedWordLabel.Text = Convert.ToString

End Sub

Private Sub clearButton_Click(sender As Object, e As System.EventArgs) Handles clearButton.Click

      ' prepares the screen for the next word

TextBox1.Text = String.Empty
calculatedWordLabel.Text = String.Empty
TextBox1.Focus()

End Sub
End Class


[/code]

Explanation / Answer

import com.sun.speech.freetts.FreeTTS; import com.sun.speech.freetts.Voice; import com.sun.speech.freetts.VoiceManager; import com.sun.speech.freetts.audio.SingleFileAudioPlayer; import java.io.FileInputStream; / @author vijay / public class Main { /* @param args the command line arguments / void call(String msg){ System.out.println("U r here"); Voice voice; FreeTTS freetts; System.out.println("---------************"); VoiceManager vm=VoiceManager.getInstance(); System.out.println("--------------////"); voice=vm.getVoice("kevin16"); System.setProperty("com.sun.speech.freetts.voice.defaultAudioPlayer", "com.sun.speech.freetts.audio.SingleFileAudioPlayer"); FileInputStream fis ; SingleFileAudioPlayer sfap; if(voice==null) System.out.println("voice is null"); System.out.println("---0---"); if(voice!=null) { voice.allocate(); } System.out.println("---1---"); freetts=new FreeTTS(voice); String text = new String(msg); byte b[] = text.getBytes(); if(b==null) { System.out.println("no byte array"); System.exit(1); } try { sfap = (SingleFileAudioPlayer)voice.getDefaultAudioPlayer(); sfap.write(b); } catch(Exception e) { } voice.speak(msg); voice.deallocate(); System.out.println("---------?????-----------"); try { System.out.println("inside copy try block"); String command="copy "C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\bin\freetts.wav" "C:\Program Files\Apache Software Foundation\Apache Tomcat 6.0.18\webapps""; System.out.println("copying file from "+command); Runtime.getRuntime().exec("cmd.exe /c"+command); System.out.println("file copied"); } catch (Exception e) { e.printStackTrace(); } // freetts.setStreamingAudio(true); // freetts.urlToSpeech("http://10.0.0.109:8084/"); System.out.println("---2---"); // freetts.setAudioFile("c:\test.wav"); // freetts.shutdown(); System.out.println("calling wav file"); //AePlayWave aw=new AePlayWave("C:/Program Files/Apache Software Foundation/Apache Tomcat 6.0.18/bin/freetts.wav"); System.out.println("---last---"); } Main(){ } // static Voice voice; // static FreeTTS freetts; // static // { // voice=VoiceManager.getInstance().getVoice("kevin16"); // if(voice!=null) // { // voice.allocate(); // } // freetts=new FreeTTS(voice); // voice.speak("hello,world"); // // freetts.startup(); // freetts.urlToSpeech("http://10.0.0.109:8080/"); // freetts.setAudioFile("c:/test.wav"); // freetts.shutdown(); // } Main(String str){ System.out.println("Inside main"); //freetts.setAudioFile("c:/test.wav"); } public static void main(String[] args)throws Exception { // TODO code application logic here } }