Requirements

Create a form as shown below.

  • You must change the colours, font, images used on the form
  • You must show your name and student number in the title of the form
  • All of the textboxes, buttons and status label must be named appropriately (e.g. Btn_Exit instead of Button7)
  • Note:
    • All 5 white boxes are all textboxes.
    • The box at the bottom of the form is a Label that has a border.

It is expected that every aspect of your solution will work correctly. Solutions that do not work will be required to be resubmitted (and incur a penalty). See image.

Task 1.

Add code so that when the user clicks the Clear button, the following occurs:

  • The data in each of all 5 text boxes is erased.
  • Clear previous messages in the Status Box and display the message "All data cleared".

Task 2.

Add code so that when the user clicks the Default Values button, the four score textboxes stores the values 1st, 3rd, 4th, and 5th digits of your student number. The Category value must be set to "A"

E.g. if the student id is 2425920 then score 1 is 2, score 2 is2, score 3 Is 5, and score 4 is 9.

  • Clear all text from the Status Box.
  • Add the text "TextBox values set to default values" to the Status Box. The text must be displayed on a new line.

Task 3.

Add code so that when the user clicks the Validate button, each of the textboxes is validated.

  • Begin by clearing the Status Box
  • Add the single most appropriate message below to the Status Box
    • Score 1 is blank
    • Score 1 is not numeric
    • Score 1 is not in the range: 0-10
    • Score 1 is valid
  • Repeat step 2 for Score 2, Score 3 and Score 4
  • Examine Category value. Add the single most appropriate message to the Status Box
    • Category is blank
    • Category is not a valid value: A, B or C
    • Category is valid

Category values are valid in both lowercase and uppercase

The following are examples of the text output in the Status Box:

Score 1 is valid or Score 1 is valid
Score 2 is blank or Score 2 is valid
Score 3 is not in the range 0-10 or Score 3 is valid
Score 4 is not numeric or Score 4 is valid
Category is not a valid value: A, B or C or Category is valid

Task 4.

Add code so that when the user clicks the Sum button:

  • If any text box contains invalid data, display the appropriate message for that text box from Task 3 in the Status Box and stop the process
    • Do not display any “is valid” messages.

Otherwise:

  • Sum all the values for scores 1 to 4 and display the total in the Status Box
    • E.g. The sum of all scores is 12

Task 5.

Add code so that when the user clicks the Average button:

  • If any text box contains invalid data, display the appropriate message for that text box from Task 3 in the Status Box and stop the process
    • Do not display any “is valid” messages.

Otherwise:

  • Calculate the average values for scores 1 to 4 and display the result in the Status Box. The average should be displayed with 2 decimal places.
    • E.g. The average of all scores is 4.33

Task 6.

Add code so that when the user clicks the Pass / Fail button:

  • If any text box contains invalid data, display the appropriate message for that text box from Task 3 in the Status Box and stop the process
    • Do not display any “is valid” messages.

Otherwise:

  • If three or more scores have a value less than 5 display "Fail: 3 scores less than 5" in the Status Box and stop the process.

Otherwise:

  • Use the Sum of all Scores and the Category Code to display the word 'Pass' or 'Fail' in the status box. The table below should be used in your calculation
Category Code Pass Mark
A 20
B 25
C 30
  • Examples:
    • If Category is A and the Sum is 19 then the result is Fail
    • If Category is A and the Sum is 20 then the result is Pass
    • If Category is B and the Sum is 24 then the result is Fail
    • If Category is B and the Sum is 25 then the result is Pass
    • If Category is C and the Sum is 29 then the result is Fail
    • If Category is C and the Sum is 30 then the result is Pass

Task 7.

Add code so that when the user clicks the Exit button:

  • Validates that the user wants to exit the application using a “Yes / No” messagebox.
  • The application ends

Code Design Rules.

  • Event Handlers must only contain Call statements.
  • Sub-procedures and Functions should be designed to be re-usable
  • The use of Class variables should be minimised.
  • All variables, sub-procedures , and functions must have meaningful names.
  • All event handlers are to be placed at the beginning of the Form Class after the Declaration Section
  • All sub-procedures and functions must be commented correctly. (event handlers do not need to be commented) See separate “Documentations Standards” document
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.