Midterm Exam 2a, CS130                    Name________________

Grade__________                                Student ID____________

                                                           

Instructions.   The exam is just one programming exercise, similar to the labs you have done except that you will not get step-by-step instructions.  The exam is open book--you may use any books or notes, the course web site, your past work, etc.  Communicating with other people is illegal—so no conversations, instant messaging, chat rooms, or email, even if you have finished the exam already.  You may use the Internet only to reach the course web site.  Make the text property of your main form Midterm2345, using your 4-digit student ID number instead of 2345, as you have done before.  If the number does not appear in the title bar of your program you will not get credit.   You can name the project file anything you like, but naming it MidtermTwo2345 should ensure that there is no clash of names with anybody else’s or your own old files.

 

You will have sixty minutes.  The exam will be graded right in the lab while you are still there.  That’s why you have only sixty minutes instead of sixty-five.  This time limit will be strictly enforced.

 

The program requirements.    The program should be an C# Windows application.   When it first opens,  the window should contain the text Right click to enter billing information.    When you right click, you see the following dialog:

 

 

The Visa button should be the default selection [the screen shot was taken later, after changing the selection].   When you enter your name (say Pablo Picasso)  in the first edit box, and an address in the second dialog box (say New York), then press OK to dismiss the dialog,  the window now contains (instead of the initial text) 

 

Your order will be billed to your Visa card and shipped to:

Pablo Picasso

New York

 

The output should be arranged in three lines as indicated.    If you right-click again and change the Pay by selection to MC,  then the output is similar, but with Mastercard in place of Visa.   

 

The keyboard interface to your dialog should work in the standard way:  All the arrow keys,  if pressed repeatedly, should cycle between the two radio buttons once either of the radio buttons has the focus.  The tab key should stop at the selected radio button and not at the other radio button.  Enter is the same as pressing OK, Esc is the same as pressing Cancel.

 

 

Test procedure and grading criteria.

 

Initial text Right click to enter billing information  appears.[5 points]

Right click brings up the dialog.    [10 points]

The caption of the dialog is Enter Billing Information [5 points]

Radio button Visa  is initially selected. [10 points]

Then a name and address will be entered, and OK pressed.

Correct text should be written.  [15 points, 5 for each control]

Now we’ll right click again.

The previously entered name and address should appear in the edit box.  [10 points]

Now we’ll change the name and address, and change from Visa to MC, and click OK.

The output should change accordingly. [15 points, 5 for each control]

Now bring the dialog box up by right-clicking.

The MC radio button  should be selected. [10 points]

 Change the name and the radio button selection and press Cancel.

The output  should not change, and on bringing up the dialog again, the changes made before Cancel should not show.   [10 points, but you only get this if OK worked right.]

Keyboard interface works as described above. [10 points]