1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Problem of the Week

Discussion in 'Visual Basic ( VB )' started by pawnamerica, Jan 30, 2015.

  1. pawnamerica

    pawnamerica New Member

    Jan 30, 2015
    Likes Received:
    Trophy Points:
    Solve the following and Post your Loop! I will compile each program you submit and post if you are right or wrong! Have Fun!
    ' LeftOrRight.vb - This program calculates the total number of left-handed and right-handed
    '                    students in a class.   
    ' Input:  L for left-handed; R for right handed; X to quit.
    ' Output: Prints the number of left-handed students and the number of right-handed students. 
    Option Explicit On
    Option Strict On
    Module LeftOrRight
       Sub Main()
    	' Declarations
            Dim LeftOrRight As String     ' L or R for one student
            Dim RightTotal As Integer = 0 ' Number of right-handed students
            Dim LeftTotal As Integer = 0  ' Number of left-handed students
    	' This is the work done in the housekeeping() procedure	
            LeftOrRight = InputBox$("Enter L if you are left-handed, R if you are right-handed or X  to quit.")
            ' This is the work done in the detailLoop() procedure
    	' Write your loop here.
    	' This is the work done in the endOfJob() procedure
            ' Output number of left or right-handed students. 
          System.Console.WriteLine("Number of left-handed students: " & LeftTotal)
          System.Console.WriteLine("Number of right-handed students: " & RightTotal)
        End Sub ' End of Main() procedure
    End Module ' End of LeftOrRight Module
    Last edited by a moderator: Jan 30, 2015

Share This Page