Wylie, Earl CIS 1 Chapter 6 Exercise 1: 10/24/12

Wylie, Earl CIS 1 Chapter 6 Exercise 1: 10/24/12

<p> Wylie, Earl CIS 1 Chapter 6 Exercise 1: 10/24/12</p><p>Chapter 6 exercise 1 – This exercise introduces for next loops, and dimensioned parallel arrays. The form size = 475 , 435, name= frmgrade, start position= center screen, text= grade. Three labels: label1 – text=grades, size=82x25,location=150,-1,font=16pt. Label2 –text=click process to enter name and score; font=16pt, bold; location=12,370;size=417x25. ; lable3-, name=lblaverage, text=blank; location =43,299. Textbox: name=txtresult, location 71,27; size=311,255; multiline=true. Three buttons: name=btnprocess, text=&Process, location=34,344; size=75,25. Name= btnclear, text=&Clear, location=153,344, size=75,25.name= btnexit, location 295,344; text=&Exit, size=75,25.. </p><p>Public Class Form1 Private strname(40) As String ‘ this creates at the modular scope and dimensioned array that will Private intgrade(40) As Integer ‘contain 41 elements.</p><p>Private Sub btnprocess_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnprocess.Click Dim intloop As Integer Dim intindex As Integer intloop = InputBox("How many student are you entering", _ "Number of students") Dim intcounter As Integer = 0 Dim dectotal As Decimal = 0 Dim decaverage As Decimal Dim strgrade As String 'initilize array For intindex = 1 To intloop strname(intindex) = InputBox("Enter student full name", "Name please") intgrade(intindex) = InputBox("Enter student final score 1 to 100", "Score Please")</p><p>'compute grade and average score</p><p> intcounter = intcounter + 1 dectotal = dectotal + intgrade(intindex) If intgrade(intindex) >= 90 Then strgrade = " A" ElseIf intgrade(intindex) >= 80 Then strgrade = " B" ElseIf intgrade(intindex) >= 70 Then strgrade = " C" ElseIf intgrade(intindex) >= 60 Then strgrade = " D" Else strgrade = " F" End If txtresult.Visible = True txtresult.AppendText(vbCrLf & strname(intindex) & " " & intgrade(intindex) & " which is a " & strgrade) Next decaverage = dectotal / intcounter lblaverage.Text = "Class average is " & decaverage.ToString("n2") End Sub</p><p>Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click Me.Close() End Sub</p><p>Private Sub btnclear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnclear.Click lblaverage.Text = "" txtresult.Clear() btnprocess.Focus() txtresult.visible=false</p><p>End Sub End Class</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    2 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us