2006 FINAL EXAM PRACTICE PROBLEMS 1. Perform a Computation Example: Input the hours worked and select one of the following radio buttons: Electrician, Plumber, Painter. If Electricians earn 85 per hour, plumbers earn 75 per hour, and painters earn 40 per hour, compute the total wages from the hours worked and the selected radio button. 2. Construct the variable trace and predict the output. Example: Public Sub Main( ) Dim x As Integer = 150 Dim y As Integer = 100 While x > 1 And y > 1 Then If x Mod 2 = 0 Then x \= 3 y \= 2 Else x \= 5 y \= 4 End If System.Console.WriteLine(x + y) End While End Sub 3. Process an input file with a StreamReader object. Example: Determine how many four letter words are in the input file words.txt. Do this under two different assumptions: (a) There is one word per line. (b) There are multiple space delimited words per line. 4. Write and test a function. Example: Write a function that inputs a string and returns this string with each space replaced by a $. Write a main method to test your function. 5. Process data from a database. Example: The table GradeData from the database grades.mdb contains the columns Name and Grade. The possible values of Grade are A, B, C, D and F. Write a Windows application that will put the names of the students with a grade of A in a listbox. 6. Write code that outputs random numbers. Example: Write a console application that outputs 1000 random zeros and ones. 7. Draw a picture in a picture box using Graphics methods. Example: Draw three filled circles in a picture box according to these specifications: Color Center Radius ------+-----------+------ Red (100,100) 40 White (200,200) 30 Blue (300,300) 20