ISM 3253
Lab Information Page
Last Update: 09/10/2008

Lab Topic Advanced Controls, Variables, Mathematical Calculations
Objectives: As a result of this instruction and after having completed the associated readings and exercises students will understand or be able to:
  1. See lecture objectives for the week
Readings: Murach Chapters 1, 2, 3, & 4
Exercises:
  • GPA Calculator:
    • Add the following controls to your form:
      • A group box containing semester information:
        • A combo box listing the three semester names ("Fall", "Spring", "Summer")
        • A combo box listing years.  Enter values going back to 1990 and going forward to 2010.
      • A group box containing course information
        • A combo box that will contain a list of department code prefixes ("ISM", "MAN", "ACC", etc.) using a style that will allow the user to select one of the choices in the list but also enter a different choice if necessary.
        • A text box to enter the course number
        • A text box to enter the section number
        • A text box to enter the course name
        • A list box containing all of the possible letter grades ("A", "A-", "B+", etc.)
        • Another list box containing the corresponding grade points for each letter grade entered in the same order as in the grades list box.  Set the height of this list box so that only one row shows and set the enabled property to False.  (Experiment with setting the Visible property of this list to False)
        • A check box that will indicate whether the current course is to be counted in the GPA
        • A label in which to record the total grade points earned for the current course (Credit hours x Grade points for the grade earned)
        • An Enter button
      • A group box containing accumulated total information
        • Three labels in which to record: Total credit hours earned, total grade points earned, overall GPA
      • An Exit button
    • Create module-scoped variables of an appropriate data type to hold total credit hours and total grade points.
    • Write the following code for the form
      • The Enter button will:
        • Calculate the total grade points earned for the current course and display the result in the appropriate label
        • Update the module scoped variables containing total grade points and total credit hours and display the results in the appropriate labels
        • Calculate the overall GPA and display the result in the appropriate label
        • Clear the input controls
        • Deselect the selected letter grade combo box.  (Set its .SelectedIndex property to -1 in code to do this.
      • Write code for the SelectedIndexChanged event of the Grades list box to set the .SelectedIndex property of the grade points list box to the same .SelectedIndex property of the Grades list box.  (Note that this code will also deselect any item in the grade points list box when the selection in the grades list box is cleared.)
      • Write code for the Exit button to end the program.  (Use Application.Exit, not Me.Close to end the program.)
    • Use the View | Tab Order technique to set the tab order for the controls on the form.  Test the tab order.
    • Set hot keys for all appropriate controls.
  • Mathematical precedence Exercise--Create a form with text boxes (with identifying static labels) to receive values for a, b, and c (txtA, etc.) four calculate buttons, and four result labels.
    • Have each button implement one of the calculations shown at the right and display the results into the appropriate label. 
    • Do the calculations by hand or with a calculator and test your results.
  • Commenting–Properly comment your code according to the style used in the sample programs.
Lecture Notes*: See lecture notes and sample programs for this week's class sessions