Programming Concepts II - Exam Review: (Ie: No Path Specified)
Programming Concepts II - Exam Review: (Ie: No Path Specified)
This review and the exam are broken up into snippets of code and a class, all of which can be tested in a
single Windows form with multiple buttons, input fields … and rich-textboxes.
Part A
1. (1 Mark) Create a Class with fields properties (Id (Int32), PropCode(string), ClubName(string))
and three Boolean class (static) methods, each validating a string parameter:
a. Method 1: IsTwoDigits - Length of 2, only digits allowed, greater than zero
b. Method 2: IsPunctuation – Two digits followed by a semicolon “;” allowed
c. Method 3: IsLetters - Only a-z characters allowed, either case
d. Create a form with 3 textboxes (one for each property) and a button. Display all error
messages in a rich-text box, one line per error.
2. (1 Mark) Add an instance method called SaveRecord to the above class to write the three
properties to a file named file1.txt, as a single tab-delimited record, you MUST use the default
location for your file (ie: no path specified). Add a button to the form to instantiate an object
of the class and use its event handler to call SaveRecord to write to file if it passes the edits.
You must be able to add several records to the file.
Part B
3. (1 Mark) Add 3 inputs initialized to “123s”, “XY;” “?3”, and a button to the form. When the
button is clicked, add the three inputs to an array.
a. Add a second button to create another array and copy each item from the first array
into it, in reverse order, without the punctuation characters. Print the results in the rich
text box, one line per element: index number and value.
e.g:
0:3
1:XY
2:123s
b. The second button should also save the record from the array to a tab delimited text file
named file2.txt, you MUST use the default location for your file and add several
records to the file.