College Admissions. The admissions offices of acolleges often rely on a point sy
ID: 3530216 • Letter: C
Question
College Admissions. The admissions offices of acolleges often rely on a point system. A point system similar to the one in Fig. 4.25 on the next page is used by a large state university. Write a program that allows an admissions officer to determine whether an applicant should be admitted. The numbers in brackets give the pont count for each response. The GPA score entered into the text box at the top of the form should be from 2.0 to 4.0. The point value in the brackets to the right of the text box is 20 times the GPA and should appear automatically after the focus leaves the text box. A total of at most 40 points can be earned forthe responses below the line. The program should calculate the total score and then admit and applicant whose score is at least 100.
The code I have so far is below...however I need to improve it. I need the GPA text box to clear if the GPA is entered is incorrectly. Additionally I need the "admitted" to be on the third line (how do I space withing the outputbox?)
Public Class frmCollegeAdmissions
Dim gpaScore, bottomScore, totalScore As Double
Private Sub mtbGPA1_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs)
If (IsNumeric(mtbGPA1.Text)) And (mtbGPA1.Text >= 2.0) And (mtbGPA1.Text <= 4.0) Then
gpaScore = (20 * (CDbl(mtbGPA1.Text)))
txtBoxGPA2.Text = CStr("[" & gpaScore & "]")
Else
MessageBox.Show("GPA is invalid. Please make sure entry is from 2.0 to 4.0")
End If
End Sub
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
If Not ((IsNumeric(mtbGPA1.Text)) And (mtbGPA1.Text >= 2.0) And (mtbGPA1.Text <= 4.0)) Then
mtbGPA1.Text = "" And MessageBox.Show("GPA is invalid. Please make sure entry is from 2.0 to 4.0")
End If
totalScore = gpaScore
If radSAT1.Checked Then
totalScore += 0
ElseIf radSAT2.Checked Then
totalScore += 6
ElseIf radSAT3.Checked Then
totalScore += 10
ElseIf radSAT4.Checked Then
totalScore += 11
ElseIf radSAT5.Checked Then
totalScore += 12
Else
MessageBox.Show("You must make a SAT selection.")
End If
If radHSQ1.Checked Then
totalScore += 0
ElseIf radHSQ2.Checked Then
totalScore += 2
ElseIf radHSQ3.Checked Then
totalScore += 4
ElseIf radHSQ4.Checked Then
totalScore += 6
ElseIf radHSQ5.Checked Then
totalScore += 8
ElseIf radHSQ6.Checked Then
totalScore += 10
Else
MessageBox.Show("You must make a High School Quality selection.")
End If
If radDOC1.Checked Then
totalScore += -4
ElseIf radDOC2.Checked Then
totalScore += -2
ElseIf radDOC3.Checked Then
totalScore += 0
ElseIf radDOC4.Checked Then
totalScore += 2
ElseIf radDOC5.Checked Then
totalScore += 4
ElseIf radDOC6.Checked Then
totalScore += 6
ElseIf radDOC7.Checked Then
totalScore += 8
Else
MessageBox.Show("You must make a Difficulty of Curriculum selection.")
End If
If chkGeo1.Checked Then
bottomScore += 10
End If
If chkGeo2.Checked Then
bottomScore += 6
End If
If chkGeo3.Checked Then
bottomScore += 2
End If
If chkAlumni1.Checked Then
bottomScore += 4
End If
If chkAlumni2.Checked Then
bottomScore += 1
End If
If chkLeadServ1.Checked Then
bottomScore += 1
End If
If chkLeadServ2.Checked Then
bottomScore += 2
End If
If chkLeadServ3.Checked Then
bottomScore += 5
End If
If radEssay1.Checked Then
bottomScore += 1
ElseIf radEssay2.Checked Then
bottomScore += 2
ElseIf radEssay3.Checked Then
bottomScore += 3
End If
If radMisc1.Checked Or radMisc3.Checked Or radMisc4.Checked Then
bottomScore += 20
ElseIf radMisc2.Checked Then
bottomScore += 5
End If
If bottomScore > 40 Then
bottomScore = 40
End If
totalScore += bottomScore
If totalScore >= 100 Then
txtBoxOutput.Text = "Total Score: " & totalScore &
"Admitted"
ElseIf totalScore < 100 Then
txtBoxOutput.Text = "Total Score: " & totalScore &
"Not Admitted"
End If
End Sub
End Class
Explanation / Answer
u can add the code to clear the GPA textbox on the lostfocus event of the Outputbox code: GPA.text="" ' for clearing the area u can try the command vbcrlf to begin on new line