Niveau | 2 of 5 |
---|---|
Learning Goals | Exception handling. |
Required Knowledge | Basic knowledge of objects. |
Challenge Type | Realise |
As a starting material, the program Name Generator is available. Open this solution and take a look at the code. The program generates a random name from a list of available names and displays that name on the screen. The list of available names is contained in the file Names.txt. The program reads this file.
Add C# code that handles all the exceptions of the program such as the IndexOutOfRangeException and file/network related exceptions and show a clear error message to the user or (even better) resolve the error without the user seeing it.
Extend the program so that either 1 or 2 names are selected as desired. The user must choose in advance whether to see 2 names or 1 name. Add user interface controls, and replace existing controls of your choice.