The admissions offices of colleges often rely on a point system. A point system similar to the one in the figure below is used by a large state university. In Visual Basic, write a program that allows an admissions officer to determine whether an applicant should be admitted. The numbers in brackets give the point 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 for the responses below the line. The program should calculate the total score and then admit an applicant whose score is at least 100.
Suggested Control Names and Attributes:
Name Property | Text Property | Container | Control Type | Notes |
frmCollege | University Admissions Point System | N/A | Form | Holds Controls |
txtGPA | frmCollege | TextBox | Captures GPA | |
txtGPAPoints | frmCollege | TextBox | Displays GPA points | |
btnCalculate | Calculate Total Score | frmCollege | Button | Triggers event to display score |
lstOutput | frmCollege | ListBox | Displays results | |
grpSAT | SAT | frmCollege | GroupBox | Holds radio buttons for SAT score |
radSAT400 | 400-920 [0] | grpSAT | RadioButton | Choose 420-920 SAT range |
radSAT930 | 930-1000 [6] | grpSAT | RadioButton | Choose 930-1000 SAT range |
radSAT1010 | 1010-1190 [10] | grpSAT | RadioButton | Choose 1010-1190 SAT range |
radSAT1200 | 1200-1350 [11] | grpSAT | RadioButton | Choose 1200-1350 SAT range |
radSAT1360 | 1360-1600 [12] | grpSAT | RadioButton | Choose 1360-1600 SAT range |
grpHSQuality | High School Quality | frmCollege | GroupBox | Holds radio buttons for HS quality |
radQuality0 | 0 [0] | grpHSQuality | RadioButton | Choose 0 HS Quality |
radQuality1 | 1 [2] | grpHSQuality | RadioButton | Choose 1 HS Quality |
radQuality2 | 2 [4] | grpHSQuality | RadioButton | Choose 2 HS Quality |
radQuality3 | 3 [6] | grpHSQuality | RadioButton | Choose 3 HS Quality |
radQuality4 | 4 [8] | grpHSQuality | RadioButton | Choose 4 HS Quality |
radQuality5 | 5 [10] | grpHSQuality | RadioButton | Choose 5 HS Quality |
grpDifficulty | Difficulty of Curriculum | frmCollege | GroupBox | Holds radio buttons for HS difficulty |
radDifficultyMinus2 | -2 [-4] | grpDifficulty | RadioButton | Choose HS difficulty -2 |
radDifficultyMinus1 | -1 [-2] | grpDifficulty | RadioButton | Choose HS difficulty -1 |
radDifficulty0 | 0 [0] | grpDifficulty | RadioButton | Choose HS difficulty 0 |
radDifficulty1 | 1 [2] | grpDifficulty | RadioButton | Choose HS difficulty 1 |
radDifficulty2 | 2 [4] | grpDifficulty | RadioButton | Choose HS difficulty 2 |
radDifficulty3 | 3 [6] | grpDifficulty | RadioButton | Choose HS difficulty 3 |
radDifficulty4 | 4 [8] | grpDifficulty | RadioButton | Choose HS difficulty 4 |
grpGeography | Geography | frmCollege | GroupBox | Holds radio buttons for geography |
chkStateResident | State Resident [10] | grpGeography | CheckBox | Choose state resident |
chkUnder1 | Underrepresented | grpGeography | CheckBox | Choose underrepresented |
chkUnder2 | Underrepresented | grpGeography | CheckBox | Choose underrepresented |
grpAlumni | Alumni | frmCollege | GroupBox | Holds radio buttons for alumni info |
chkLegacy | Legacy (parents, stepparents) [4] | grpAlumni | CheckBox | Choose legacy alumni |
chkOther | Other (grandparents, sibilings) [1] | grpAlumni | CheckBox | Choose other alumni |
grpEssay | Essay | frmCollege | GroupBox | Holds radio buttons for essay |
radVeryGood | Very Good [1] | grpEssay | RadioButton | Choose very good essay |
radExcellent | Excellent [2] | grpEssay | RadioButton | Choose excellent essay |
radOutstanding | Outstanding [3] | grpEssay | RadioButton | Choose outstanding essay |
grpLeadership | Leadership and Service | frmCollege | GroupBox | Holds radio buttons for essay |
chkStateService | State [1] | grpLeadership | CheckBox | Choose state leadership or service |
chkRegional | Regional [2] | grpLeadership | CheckBox | Choose regional leadership or service |
chkNational | National [5] | grpLeadership | CheckBox | Choose national leadership or service |
grpMisc | Miscellaneous | frmCollege | GroupBox | Holds radio buttons for miscellaneous |
radSocioEcon | Socioeconomic disadvantage [20] | grpMisc | RadioButton | Choose socio-econ disadvantage |
radNursing | Men in Nursing [5] | grpMisc | RadioButton | Choose men in nursing |
radAthlete | Scholarship Athlete [20] | grpMisc | RadioButton | Choose scholarship athlete |
radDiscretion | Provost’s Discretion [20] | grpMisc | RadioButton | Choose provost’s discretion |
Write the Code:
' Project: College Admissions ' Description: Determines whether a student is admitted or rejected to a college based on various score factors Public Class frmCollege Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click Dim gpa As Double = CDbl(txtGPA.Text) Dim gpaPoints As Integer = CInt(gpa * 20) Dim SATPoints As Integer = 0 Dim qualityPoints As Integer = 0 Dim difficultyPoints As Integer = 0 Dim otherPoints As Integer = 0 ' variable to hold total score of items in lower half of form Dim geographyPoints As Integer = 0 Dim alumniPoints As Integer = 0 Dim essayPoints As Integer = 0 Dim leadershipPoints As Integer = 0 Dim miscPoints As Integer = 0 Dim totalScore As Integer = 0 txtGPAPoints.Text = gpaPoints.ToString ' Determine SAT points If (radSAT400.Checked = True) Then SATPoints = 0 ElseIf (radSAT930.Checked = True) Then SATPoints = 6 ElseIf (radSAT1010.Checked = True) Then SATPoints = 10 ElseIf (radSAT1200.Checked = True) Then SATPoints = 11 ElseIf (radSAT1360.Checked = True) Then SATPoints = 12 End If ' Determine points for high school quality If (radQuality0.Checked = True) Then qualityPoints = 0 ElseIf (radQuality1.Checked = True) Then qualityPoints = 2 ElseIf (radQuality2.Checked = True) Then qualityPoints = 4 ElseIf (radQuality3.Checked = True) Then qualityPoints = 6 ElseIf (radQuality4.Checked = True) Then qualityPoints = 8 ElseIf (radQuality5.Checked = True) Then qualityPoints = 10 End If ' Determine points for difficulty of curriculum If (radDifficultyMinus2.Checked = True) Then difficultyPoints = -4 ElseIf (radDifficultyMinus1.Checked = True) Then difficultyPoints = -2 ElseIf (radDifficulty0.Checked = True) Then difficultyPoints = 0 ElseIf (radDifficulty1.Checked = True) Then difficultyPoints = 2 ElseIf (radDifficulty2.Checked = True) Then difficultyPoints = 4 ElseIf (radDifficulty3.Checked = True) Then difficultyPoints = 6 ElseIf (radDifficulty4.Checked = True) Then difficultyPoints = 8 End If ' Determine geography points If (chkStateResident.Checked = True) Then geographyPoints = 10 Else geographyPoints = 0 End If ' Determine alumni points ' Note that more than one can be selected, so we add to the total points for each checked option If (chkLegacy.Checked = True) Then alumniPoints += 4 End If If (chkOther.Checked = True) Then alumniPoints += 1 End If ' Determine essay points If (radVeryGood.Checked = True) Then essayPoints = 1 ElseIf (radExcellent.Checked = True) Then essayPoints = 2 ElseIf (radOutstanding.Checked = True) Then essayPoints = 3 End If ' Determine leadership points ' Note that more than one can be selected, so we add to the total points for each checked option If (chkStateService.Checked = True) Then leadershipPoints += 1 End If If (chkRegional.Checked = True) Then leadershipPoints += 2 End If If (chkNational.Checked = True) Then leadershipPoints += 5 End If ' Determine miscellaneous points If (radSocioEcon.Checked = True) Then miscPoints = 20 ElseIf (radNursing.Checked = True) Then miscPoints = 5 ElseIf (radAthlete.Checked = True) Then miscPoints = 20 ElseIf (radDiscretion.Checked = True) Then miscPoints = 20 End If ' Display total score and admissions decision otherPoints = geographyPoints + alumniPoints + essayPoints + leadershipPoints + miscPoints If (otherPoints > 40) Then otherPoints = 40 End If totalScore = gpaPoints + SATPoints + qualityPoints + difficultyPoints + otherPoints lstOutput.Items.Clear() lstOutput.Items.Add("Total Score: " & totalScore) lstOutput.Items.Add(" ") If (totalScore >= 100) Then lstOutput.Items.Add("Admitted") Else lstOutput.Items.Add("Rejected") End If End Sub End Class