Programming C# (Visual Studio Version 2008)
Q1. Write a GUI program that reads a five-letter word from the user and produces all probable three letter combinations which can be derived from letters of the five-letter word. For illustration, the three-letter words produced from the word “bathe” include the commonly employed words “ate,” “bat,” “bet,” “tab,” “hat,” “the” and “tea,” and the 3-letter combinations “bth,” “eab,” etc. Have a “Save” button and use SaveFileDialog to save the results to a file. Also, have an “Open” button and find the five letters which are used to generate the opened file. A possible GUI is given below; feel free to design your own GUI.
Q2. Assume we wish to process survey results that are stored in a file. First, create a Windows Form that prompts the user for survey responses and outputs each response to a file. Use StreamWriter to create a file called numbers.txt. Each integer must be written using technique Write. Then add a TextBox that will output the frequency of survey responses. You should read the survey responses from numbers.txt. The responses should be read from the file by using a StreamReader. Class string’s split method should be used to split the input string into separate responses, and then each response should be converted to an integer. The program should continue to read responses until it reaches the end of file. The results should be output to the TextBox.
A possible GUI is given below; feel free to design your own GUI.
GUI DEDIGN:
------------------------------------------------------------------------------------
student poll __ [] x
-----------------------------------------------------------------------------------
Enter an Integer (1-10) and press enter
-------------------
------------------- Done (button here)
-------------------------------------------------------------------------------------
GUI DEDIGN:
------------------------------------------------------------------------------------
student poll __ [] x
-----------------------------------------------------------------------------------
Enter an Integer (1-10) and press enter
-------------------
------------------- Done (button here)
-------------------
------------------- View Survey Results (click button here)
Rating Frequency
1 9
2 4
3 3
4 3
5 4
6 2
7 3
8 5
9 6
10 7
-------------------------------------------------------------------------------------