Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here\'s the question I have to answer. It\'s from ISBN 978-1-13-352608-7 from pa

ID: 671049 • Letter: H

Question

Here's the question I have to answer. It's from ISBN 978-1-13-352608-7 from pages 36 to 38. It's lab 3.1

In this lab, you use the pseudocode in Figure 3-3 to add code to a partially created Visual Basic program. When completed, college admissions officers should be able to use the Visual Basic program to determine whether to accept or reject a student, based on his or her test score and class rank.


Figure 3-3 below

start
   input testScore, classRank
   if testScore >= 90 then
      if classRank >= 25 then
        output "Accept"
      else
        output "Reject"
      endif
   else
      if testScore >= 80 then
        if classRank >= 50 then
          output "Accept"
        else
          output "Reject"
        endif
      else
        if testScore >= 70 then
          if classRank >= 75 then
            output "Accept"
          else
            output "Reject"
          endif
        else
          output "Reject"
        endif
      endif
   endif
stop


Here are the steps I have to follow.

1. Study the pseudocode in figure 3-3.
2. Open the source code file named CollegeAdmission.vb using Notepad or the text editor of your choice.
3. Declare two String variables named testScoreString and classRankString.
4. Declare two Integer variables named testScore and classRank.
5. Write the interactive input statements to retrieve a student's test score and class rank from the user program.
6. Write the statements to convert the String representation of a student's test score and class rank to the Integer data type.
7. The rest of the program is written for you. Save this source code file in a directory of your choice, and then make that directory your working directory.
8. Compile the source code file CollegeAdmission.vb.
9. Execute the program by entering 30 for the test score and 95 for the class rank. Record the output of this program.
10. Execute the program by entering 95 for the test score and 30 for the class rank. Record the output of this program.

Here's the CollegeAdmission.vb code


' Program Name: CollegeAdmission.vb
' Function: This program determines if a student will be admitted or rejected.
' Input: Interactive
' Output: Accept or Reject
Option Explicit On
Option Strict On
Module CollegeAdmission
   Sub Main()

     ' Declare variables
   
   
     ' Get input and convert to correct data type
   

     ' Test using admission requirements and print Accept or Reject
     If testScore >= 90 then
        If classRank >= 25 then
            System.Console.WriteLine("Accept")
   Else
       System.Console.WriteLine("Reject")
        End If
     Else
   If testScore >= 80 then
       If classRank >= 50 then
          System.Console.WriteLine("Accept")
       Else
          System.Console.WriteLine("Reject")
           End If
   Else
           If testScore >= 70 then
          If classRank >=75 then
           System.Console.WriteLine("Accept")
          Else
           System.Console.WriteLine("Reject")
              End If
       Else
       System.Console.WriteLine("Reject")
           End If
        End If
      End If
   End Sub
  
End Module

Explanation / Answer

' Program Name: CollegeAdmission.vb
' Function: This program determines if a student will be admitted or rejected.
' Input: Interactive
' Output: Accept or Reject
Option Explicit On
Option Strict On
Module CollegeAdmission
Sub Main()
' Declare variables
dim testScoreString, classRankString as String
dim testScore, classRank as integer

' Get input and convert to correct data type
testScoreString = InputBox("Enter Test Score", "myinput",0)

classRankString = InputBox("Enter class Rank", "myinput",0)

testScore = val(testScoreString)
classRank = val(classRankString)


' Test using admission requirements and print Accept or Reject
If testScore >= 90 then
If classRank >= 25 then
System.Console.WriteLine("Accept")
Else
System.Console.WriteLine("Reject")
End If
Else
If testScore >= 80 then
If classRank >= 50 then
System.Console.WriteLine("Accept")
Else
System.Console.WriteLine("Reject")
End If
Else
If testScore >= 70 then
If classRank >=75 then
System.Console.WriteLine("Accept")
Else
System.Console.WriteLine("Reject")
End If
Else
System.Console.WriteLine("Reject")
End If
End If
End If
End Sub
  
End Module