Note that there are some explanatory texts on larger screens.

plurals
  1. POArray as structure members Assignment Student Test Scores
    primarykey
    data
    text
    <p>ASSIGNMENT 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. </p> <p><img src="https://i.stack.imgur.com/pefJt.png" alt="Form"></p> <p>]</p> <p>my understanding of how it should be structured <img src="https://i.stack.imgur.com/jjRnU.png" alt="enter image description here"></p> <p>For the Moment I don't understand that in the FOR EACH loop I can not accumulate total it saying that I am not allowed to use + . I am trying to get scores from txtScore1Std1 (For example) assign it to dblTestScoreArray and using for each loop to find sum of those 5 score and when find average and output it to lbl average for student number 1.</p> <p>Code Module:</p> <pre><code> Module StudentTestScoresModule Const intMAX_SUBSCRIPT_STUDENT As Integer = 6 Const intMAX_SUBSCRIPT_STUDENT_SCORES As Integer = 5 'create structure Public Structure StudentData Dim strName As String Dim dblTestScoresArray() As Double Dim dblAverage As Double End Structure Dim dblTotalStd1 As Double Dim dblScore As Double Dim StudentsArray(intMAX_SUBSCRIPT_STUDENT) As StudentData Sub StudentNameDataInput() StudentsArray(0).strName = MainForm.txtStdName1.Text StudentsArray(1).strName = MainForm.txtStdName2.Text StudentsArray(2).strName = MainForm.txtStdName3.Text StudentsArray(3).strName = MainForm.txtStdName4.Text StudentsArray(4).strName = MainForm.txtStdName5.Text StudentsArray(5).strName = MainForm.txtStdName6.Text End Sub Sub StudentScoreDataInput() For intIndex = 0 To intMAX_SUBSCRIPT_STUDENT ReDim StudentsArray(intIndex).dblTestScoresArray(4) Next 'test scores for first student StudentsArray(0).dblTestScoresArray(0) = CDbl(MainForm.txtScore1Std1.Text) StudentsArray(1).dblTestScoresArray(1) = CDbl(MainForm.txtScore2Std1.Text) StudentsArray(2).dblTestScoresArray(2) = CDbl(MainForm.txtScore3Std1.Text) StudentsArray(3).dblTestScoresArray(3) = CDbl(MainForm.txtScore4Std1.Text) StudentsArray(4).dblTestScoresArray(4) = CDbl(MainForm.txtScore5Std1.Text) For Each i As StudentData In StudentsArray dblTotalStd1 += i Next dblAverage = dblTotalStd1 / intMAX_SUBSCRIPT_STUDENT_SCORES MainForm.lblAvgStd1.Text = (dblAverage.ToString) End Sub Sub CalculateAverage() End Sub End Module </code></pre> <p>Code Main Form:</p> <pre><code> Public Class MainForm Private Sub mnuHelpAbout_Click(sender As Object, e As EventArgs) Handles mnuHelpAbout.Click 'about program MessageBox.Show("Student test score calculator version 0.1") End Sub Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click ' Close(program) Me.Close() End Sub Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click StudentScoreDataInput() End Sub End Class </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload