Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A teacher has six students and wants you to create an application that stores th

ID: 3534719 • Letter: A

Question

A teacher has six students and wants you to create an application that stores their grade data in a file and prints a grade report. The application should have a structure that stores the following student data: Name (a string), Test Scores (an array of five Doubles), and Average (a Double). Because the teacher has six students, the application should use an array of six structure variables.


The application should allow the user to enter data for each student, and calculate the average test score.



The user should be abled to save the data to a file, read the data from the file, and print a report showing each student's test scores and average score. The form shows a meny system. You may you buttons instead if you prefer.


Input validation: Do not accept test scores less that zero or greater than 100.

Explanation / Answer

Public Class Form1

02

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

03

' This prodecure calculates the average test score of

04

' five scores and displays the average in lblAverage.

05

06

' Variables

07

Dim TestScore1 As Integer ' Test Score 1

08

Dim TestScore2 As Integer ' Test Score 2

09

Dim TestScore3 As Integer ' Test Score 3

10

Dim TestScore4 As Integer ' Test Score 4

11

Dim TestScore5 As Integer ' Test Score 5

12

13

' Get the scores entered by the user

14

TestScore1 = TxtTestScore1.Text

15

TestScore2 = TxtTestScore2.Text

16

TestScore3 = TxtTestScore3.Text

17

TestScore4 = TxtTestScore4.Text

18

TestScore5 = TxtTestScore5.Text

19

20

' Calculate the average score

21

lblAverage = (TestScore1 + TestScore2 + TestScore3 + TestScore4 + TestScore5) / 5

22

23

' Display the average score

24

lblAverage.Text = lblAverage.ToString("n1")

25

End Sub

26

Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click

27

' Clear the TextBoxes.

28

TxtTestScore1.Text = String.Empty

29

TxtTestScore2.Text = String.Empty

30

TxtTestScore3.Text = String.Empty

31

TxtTestScore4.Text = String.Empty

32

TxtTestScore5.Text = String.Empty

33

lblAverage.Text = String.Empty

34

35

' Reset the focus.

36

TxtTestScore1.Focus()

37

End Sub

38

39

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click

40

' End the application by closing the window.

41

Me.Close()

42

End Sub

43

End Class

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote