I'm trying to create an app in Visual Basic 2012, I am struggling to get it to meet the parameters. What am I doing wrong? Every time I try to add Else it says there must be an If preceding it. The Problem:
Write a program for a college’s admissions office. Create variables that store a numeric high school grade point average and an admission test score (two different criteria can be used using an “and” for example if gpa >=3.6 and score >=60 then ) Print the message “Accept” if the student has any of the following:
- A grade point average of 3.6 or above and an admission test score of at least 60
- A grade point average of 3.0 or above and an admission test score of at least 70
- A grade point average of 2.6 or above and an admission test score of at least 80
- A grade point average of 2.0 or above and an admission test score of at least 90
If the student does not meet any of the qualifications, print “Reject”. The picture below will give you a reference how your interface should look.
If txtGPA.Text >= 3.6 And txtAdmissionTestScore.Text >= 60 Then txtAdmissionResult.Text = "Accept"
If txtGPA.Text >= 3.6 And txtAdmissionTestScore.Text <= 59 Then txtAdmissionResult.Text = "Reject"
If txtGPA.Text >= 3.0 And txtAdmissionTestScore.Text >= 70 Then txtAdmissionResult.Text = "Accept"
If txtGPA.Text >= 3.0 And txtAdmissionTestScore.Text <= 69 Then txtAdmissionResult.Text = "Reject"
If txtGPA.Text >= 2.6 And txtAdmissionTestScore.Text >= 80 Then txtAdmissionResult.Text = "Accept"
If txtGPA.Text >= 2.6 And txtAdmissionTestScore.Text <= 79 Then txtAdmissionResult.Text = "Reject"
If txtGPA.Text >= 2.0 And txtAdmissionTestScore.Text >= 90 Then txtAdmissionResult.Text = "Accept"
If txtGPA.Text >= 2.0 And txtAdmissionTestScore.Text <= 89 Then txtAdmissionResult.Text = "Reject"
If txtGPA.Text <= 1.9 And txtAdmissionTestScore.Text <= 59 Then txtAdmissionResult.Text = "Reject"
You need to do something like this. Note I am checking for the common condition then checking sub conditions, the sub conditions are either accept or reject. Therefore you only need to test for one.