Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

of 9 Automatic Zoom Actual Size Page Fit Page Width 50% 75% 100% 125% 150% 200% 300% 400% Ch8Ex7 Coding Template Name: Ricky Z NOTE:

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

of 9

Automatic Zoom Actual Size Page Fit Page Width 50% 75% 100% 125% 150% 200% 300% 400%

Ch8Ex7 Coding Template Name: Ricky Z NOTE: Your forms will look like these below BUT IN ADDITION will have your name in a label control on the form and I will be able to see the access keys on your form/s. You will be submitting 4 screenshots for this assignment. NOTE: If your name is not in a label control on the main form, you will NOT get any credit for this assignment! You will submit all 8 screenshots for this assignment. MainForm.vb Public Class MainForm Private Sub btnEditStudentData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEditStudentData.Click DisplayStudentForm() ' Display the StudentForm form. End Sub Private Sub btnCalculateGradeAverages_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateGradeAverages.Click

DisplayStudentNames() ' Display the student names. DisplayTestAverages() ' Display the test averages. DisplayLetterGrades() ' Display the letter grades. End Sub Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click ' Close the MainForm form. Me.Close() End Sub ' The DisplayStudentForm procedure displays the StudentForm form. Sub DisplayStudentForm() ' Create an instance of the StudentForm form. Dim frmStudent As New StudentForm ' Display the StudentForm form. frmStudent.ShowDialog() End Sub 'The DisplayStudentNames procedure displays the name of each student. Sub DisplayStudentNames() lblNameStudent1.Text = lblNameStudent2.Text = lblNameStudent3.Text = lblNameStudent4.Text = lblNameStudent5.Text = End Sub 'The DisplayTestAverages procedure displays the test average for each student. Sub DisplayTestAverages() ' Display the test averages for each student. lblAverageStudent1.Text = lblAverageStudent2.Text = lblAverageStudent3.Text = lblAverageStudent4.Text = lblAverageStudent5.Text = End Sub ' The DisplayLetterGrades procedure calculates ' and displays the letter grade for each student. Sub DisplayLetterGrades() ' Store the test averages for each student. Dim sngStudentAverages() As Single = { } ' Determine the letter grade for each student. For To Select Case Case To = " " Case To = " " Case To = " " Case To = " " Case Else = " " End Select Next ' Display the letter grades in the labels.

lblGradeStudent1.Text = lblGradeStudent2.Text = lblGradeStudent3.Text = lblGradeStudent4.Text = lblGradeStudent5.Text = End Sub ' Total function returns the sum of values in an array. Function Total(ByVal sngValues() As Single) As Single Dim sngTotal As Single = 0 ' To hold the total Dim intCount As Integer ' Counter variable ' Total the values. For To Next ' Return the total. Return sngTotal End Function ' The Average function returns the average. Function Average(ByVal sngValues() As Single) As Single ' Store the total. Dim sngTotal As Single = Total(sngValues) ' Store the number of values to divide by. Dim intNumValues As Integer = sngValues.Length 'Return the average. Return End Function End Class StudentForm.vb Public Class StudentForm Private Sub StudentForm_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated ' Display data in the text boxes. DisplayStudentNames() DisplayTestScores() End Sub Private Sub btnSaveChanges_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveChanges.Click ' Store the data in the global arrays. End Sub Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click ' Close the StudentForm form. Me.Close() End Sub ' The ResetStudentData procedure resets the student and test score data. Private Sub ResetStudentData()

Dim intStudentIndex As Integer = 0 ' Student counter variable Dim intScoreIndex As Integer = 0 ' Test score counter variable ' Reset the student data For To Next ' Reset the test score data For To Next End Sub Private Sub btnResetData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnResetData.Click ' Display a message box indicating that all data will be lost. Dim intResult As Integer = MessageBox.Show("Warning: All previous data will be lost.", "Reset Data", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) ' If the user clicks OK, then reset all data. If intResult = DialogResult.OK Then ' Reset the data in the global arrays ' Clear the Text in the text boxes. txtNameStudent1.Clear() txtNameStudent2.Clear() txtNameStudent3.Clear() txtNameStudent4.Clear() txtNameStudent5.Clear() txtStudent1Score1.Clear() txtStudent1Score2.Clear() txtStudent1Score3.Clear() txtStudent1Score4.Clear() txtStudent2Score1.Clear() txtStudent2Score2.Clear() txtStudent2Score3.Clear() txtStudent2Score4.Clear() txtStudent3Score1.Clear() txtStudent3Score2.Clear() txtStudent3Score3.Clear() txtStudent3Score4.Clear() txtStudent4Score1.Clear() txtStudent4Score2.Clear() txtStudent4Score3.Clear() txtStudent4Score4.Clear() txtStudent5Score1.Clear() txtStudent5Score2.Clear() txtStudent5Score3.Clear() txtStudent5Score4.Clear() ' Give the Focus to the txtNameStudent1 text box. txtNameStudent1.Focus() End If End Sub

' The DisplayStudentNames procedure displays the name of each student. Sub DisplayStudentNames() txtNameStudent1.Text = txtNameStudent2.Text = txtNameStudent3.Text = txtNameStudent4.Text = txtNameStudent5.Text = End Sub ' The DisplayTestScores procedure displays the test scores for each student. Sub DisplayTestScores() txtStudent1Score1.Text = txtStudent1Score2.Text = txtStudent1Score3.Text = txtStudent1Score4.Text = txtStudent2Score1.Text = txtStudent2Score2.Text = txtStudent2Score3.Text = txtStudent2Score4.Text = txtStudent3Score1.Text = txtStudent3Score2.Text = txtStudent3Score3.Text = txtStudent3Score4.Text = txtStudent4Score1.Text = txtStudent4Score2.Text = txtStudent4Score3.Text = txtStudent4Score4.Text = txtStudent5Score1.Text = txtStudent5Score2.Text = txtStudent5Score3.Text = txtStudent5Score4.Text = End Sub ' The StoreStudentNames procedure stores the name of each student. Sub StoreStudentNames() End Sub ' The StoreTestScoresStudent1 procedure validates and then ' stores the test scores in the global array for student 1. Sub StoreTestScoresStudent1() ' Get the first test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the second test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the third test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then

' Get the fourth test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then Else ' Display a message to the user indicating that the fourth score was invalid. MessageBox.Show("Student # 1: " & txtNameStudent1.Text & ControlChars.CrLf & "The fourth test score must be a number between 0 and 100.", "Invalid Test Score") End If Else ' Display a message to the user indicating that the third score was invalid. MessageBox.Show(" ") End If Else ' Display a message to the user indicating that the second score was invalid. MessageBox.Show(" ") End If Else ' Display a message to the user indicating that the first score was invalid. MessageBox.Show(" ") End If End Sub ' The StoreTestScoresStudent2 procedure validates and then ' stores the test scores in the global array for student 2. Sub StoreTestScoresStudent2() ' Get the first test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the second test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the third test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the fourth test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then Else ' Display a message to the user indicating that the fourth score was invalid. MessageBox.Show(" ") End If Else ' Display a message to the user indicating that the third score was invalid. MessageBox.Show(" ") End If Else ' Display a message to the user indicating that the second score was invalid. MessageBox.Show(" ") End If Else ' Display a message to the user indicating that the first score was invalid. MessageBox.Show(" ") End If

End Sub ' The StoreTestScoresStudent3 procedure validates and then ' stores the test scores in the global array for student 3. Sub StoreTestScoresStudent3() ' Get the first test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the second test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the third test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the fourth test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then Else ' Display a message to the user indicating that the fourth score was invalid. MessageBox.Show(" ") End If Else ' Display a message to the user indicating that the third score was invalid. MessageBox.Show(" ") End If Else ' Display a message to the user indicating that the second score was invalid. MessageBox.Show(" ") End If Else ' Display a message to the user indicating that the first score was invalid. MessageBox.Show(" ") End If End Sub ' The StoreTestScoresStudent4 procedure validates and then ' stores the test scores in the global array for student 4. Sub StoreTestScoresStudent4() ' Get the first test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the second test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the third test score as input from the user. ' Verify that the value is a number between 0 and 100. If Single.TryParse( ) And And Then ' Get the fourth test score as input from the user. ' Verify that the value is a number between 0 and 100.

**If you are given actual test data to use in runtime from the textbook, use it unless I specifically state to use or test for something else. **If there is more than one form in the application, you are to submit runtime forms, code and code modules for all forms in the application. Make sure the MainForm has a label control with your name, and all code windows and code modules have your name and exercise number included in the documentation at the beginning of the code window. **Put all runtime forms at the beginning of the Word document** Assignment: Ch8Ex7 pgs. 570-571 70 points *** Follow the instructions in the textbook. *** Use the following test data. Student 1: 95 108 87 90 -take a screenshot of the error message then replace the score of 108 with 98 Student 2: -86 89 84 79 -take a screenshot of the error message then replace the score of -86 with 86 Student 3: 72 78 75 81 Student 4: 70 63 68 71 IS more unan me forms, , you the application. Make sure the MainForm has a label control with your name, and all code windows and code modules have your name and exercise number included in the documentation at the beginning of the code window. **Put all runtime forms at the beginning of the Word document** Assignment: Ch8Ex7 pgs. 570-571 70 points *** Follow the instructions in the textbook. *** Use the following test data. Student 1: 95 108 87 90 -take a screenshot of the error message then replace the score of 108 with 98 Student 2: -86 89 84 79 -take a screenshot of the error message then replace the score of -86 with 86 Student 3: 72 78 81 75 Student 4: 70 63 68 71 Student 5: 52 48 60 58 Ch8EX7 Coding Template NOTE: Your forms will look like these below BUT IN ADDITION will have your name in a label control on the form and I will be able to see the access keys on your form/s. You will be submitting 4 screenshots for this assignment. NOTE: If your name is not in a label control on the main form, you will NOT get any credit for this assignment! You will submit all 8 screenshots for this assignment. Edithane Edit Student Data - a Nama Test Scores Name Test Scores Student 1 95 108 87 90 Student 1 96 100 g 0 0 0 0 0 0 0 0 lo 0 lo lo lo 0 JO o 0 0 0 10 0 0 lo 0 OOO lo 0 o 0 0 Invalid Test Score X 0 lo 100 0 O 0 0 lo 0 0 Student 1: Student 1 The second test score must be a number between 0 and 100 Save Changos Reset Data Close Save Changes Besel Data Close OK Sant Dute X Tot Shien Dwa Name Test Scores Name Test Scores Student 95 99 87 90 Student 1 95 98 87 90 Student 2 99 84 79 Student 2 86 0 0 0 0 0 0 0 0 0 0 0 0 ld 0 0 0 lo Invalid Test Score 0 0 0 lo 0 0 0 0 lo 0 0 0 0 0 0 O Student # 2: Student 2 The first test score must be a number between 0 and 100. Name Tast Scores Namo Test Scores Sludant 1 95 98 87 90 Student 1 95 98 87 90 Sturlan 2 86 23 84 79 7 Student 2 -86 0 0 0 0 0 0 0 0 0 0 lo lo 0 0 0 0 0 Invalid Test Score 0 0 0 0 0 0 0 0 10 0 0 0 0 0 Student # 2: Student 2 The first test score must be a number between 0 and 100, Save Changes Reset Data Close Save Changes Reset Data Close OK Edit Student Data Grade Book Name Test Scores Name Average Grade Student 1 95 98 87 90 Student 1 92.50 A Student 2 86 89 84 79 Student 2 84.50 B Student 3 72 78 75 81 Student 3 76.50 Student 4 70 63 68 71 Student 4 68.00 D Student 5 52 48 60 58 Student 5 54.50 F F Save Changes Reset Data Close Edit Student Data Calculate Grade Averages Close Main Form.vb Public class MainForm **If you are given actual test data to use in runtime from the textbook, use it unless I specifically state to use or test for something else. **If there is more than one form in the application, you are to submit runtime forms, code and code modules for all forms in the application. Make sure the MainForm has a label control with your name, and all code windows and code modules have your name and exercise number included in the documentation at the beginning of the code window. **Put all runtime forms at the beginning of the Word document** Assignment: Ch8Ex7 pgs. 570-571 70 points *** Follow the instructions in the textbook. *** Use the following test data. Student 1: 95 108 87 90 -take a screenshot of the error message then replace the score of 108 with 98 Student 2: -86 89 84 79 -take a screenshot of the error message then replace the score of -86 with 86 Student 3: 72 78 75 81 Student 4: 70 63 68 71 IS more unan me forms, , you the application. Make sure the MainForm has a label control with your name, and all code windows and code modules have your name and exercise number included in the documentation at the beginning of the code window. **Put all runtime forms at the beginning of the Word document** Assignment: Ch8Ex7 pgs. 570-571 70 points *** Follow the instructions in the textbook. *** Use the following test data. Student 1: 95 108 87 90 -take a screenshot of the error message then replace the score of 108 with 98 Student 2: -86 89 84 79 -take a screenshot of the error message then replace the score of -86 with 86 Student 3: 72 78 81 75 Student 4: 70 63 68 71 Student 5: 52 48 60 58 Ch8EX7 Coding Template NOTE: Your forms will look like these below BUT IN ADDITION will have your name in a label control on the form and I will be able to see the access keys on your form/s. You will be submitting 4 screenshots for this assignment. NOTE: If your name is not in a label control on the main form, you will NOT get any credit for this assignment! You will submit all 8 screenshots for this assignment. Edithane Edit Student Data - a Nama Test Scores Name Test Scores Student 1 95 108 87 90 Student 1 96 100 g 0 0 0 0 0 0 0 0 lo 0 lo lo lo 0 JO o 0 0 0 10 0 0 lo 0 OOO lo 0 o 0 0 Invalid Test Score X 0 lo 100 0 O 0 0 lo 0 0 Student 1: Student 1 The second test score must be a number between 0 and 100 Save Changos Reset Data Close Save Changes Besel Data Close OK Sant Dute X Tot Shien Dwa Name Test Scores Name Test Scores Student 95 99 87 90 Student 1 95 98 87 90 Student 2 99 84 79 Student 2 86 0 0 0 0 0 0 0 0 0 0 0 0 ld 0 0 0 lo Invalid Test Score 0 0 0 lo 0 0 0 0 lo 0 0 0 0 0 0 O Student # 2: Student 2 The first test score must be a number between 0 and 100. Name Tast Scores Namo Test Scores Sludant 1 95 98 87 90 Student 1 95 98 87 90 Sturlan 2 86 23 84 79 7 Student 2 -86 0 0 0 0 0 0 0 0 0 0 lo lo 0 0 0 0 0 Invalid Test Score 0 0 0 0 0 0 0 0 10 0 0 0 0 0 Student # 2: Student 2 The first test score must be a number between 0 and 100, Save Changes Reset Data Close Save Changes Reset Data Close OK Edit Student Data Grade Book Name Test Scores Name Average Grade Student 1 95 98 87 90 Student 1 92.50 A Student 2 86 89 84 79 Student 2 84.50 B Student 3 72 78 75 81 Student 3 76.50 Student 4 70 63 68 71 Student 4 68.00 D Student 5 52 48 60 58 Student 5 54.50 F F Save Changes Reset Data Close Edit Student Data Calculate Grade Averages Close Main Form.vb Public class MainForm

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamentals Of Financial Management Concise

Authors: Eugene F. Brigham, Joel F. Houston

11th Edition

0357517717, 9780357517710

More Books

Students also viewed these Finance questions