Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Module Module1
- Sub Main()
- 'BiggestNumber()
- 'DriversAge()
- 'Currency()
- 'RomanNumerals()
- 'Buissness()
- 'SportsClub()
- 'RockPaperScissors()
- 'LogicGates()
- AdvancedNumerals()
- End Sub
- Sub BiggestNumber()
- Dim Num1 As Integer
- Dim num2 As Integer
- Console.WriteLine("Please input the first number")
- Num1 = Console.ReadLine()
- Console.WriteLine("Please input the second number")
- num2 = Console.ReadLine()
- Console.WriteLine("The bigger number is: ")
- If Num1 > num2 Then
- Console.Write(Num1)
- ElseIf Num1 < num2 Then
- Console.Write(num2)
- End If
- Console.ReadKey()
- End Sub
- Sub DriversAge()
- Dim Age As Integer
- Console.WriteLine("Please input your age (years)")
- Age = Console.ReadLine()
- If Age >= 17 Then
- Console.WriteLine("You are old enough to drive")
- ElseIf Age < 17 Then
- Console.WriteLine("You are not old enough to drive")
- End If
- Console.ReadKey()
- End Sub
- Sub Currency()
- Dim Input As Single
- Dim Euros As Single
- Dim Commision As Single
- Dim Output As Single
- Console.WriteLine("Please enter the amount of Pounds you wish to convert to Euros")
- Input = Console.ReadLine()
- Commision = Euros / 100 * 2
- If Commision < 2 Then
- Commision = 2
- End If
- Euros = (Input * 1.5) - Commision
- Output = Euros - Commision
- Console.WriteLine("You get: " & Euros & " Euros")
- Console.ReadKey()
- End Sub
- Sub RomanNumerals()
- Dim UserInput As Integer
- Dim Numeral As String = "I"
- Console.WriteLine("Please input a number you wish to be converted into roman numerals")
- UserInput = Console.ReadLine()
- Select Case UserInput
- Case 1
- Numeral = "I"
- Case 5
- Numeral = "V"
- Case 10
- Numeral = "X"
- Case 50
- Numeral = "L"
- Case 100
- Numeral = "C"
- Case 500
- Numeral = "D"
- Case 1000
- Numeral = "M"
- End Select
- Console.WriteLine(Numeral)
- Console.ReadKey()
- End Sub
- Sub Buissness()
- Dim CostPerNight As Integer
- Dim Distance As Integer
- Console.WriteLine("Please input the distance")
- Distance = Console.ReadLine()
- Console.WriteLine("Please input the cost per night")
- CostPerNight = Console.ReadLine()
- If Distance <= 5 And CostPerNight <= 60 Then
- Console.WriteLine("The company will pay your expenses")
- Else
- Console.WriteLine("The company will not pay your expenses")
- End If
- Console.ReadKey()
- End Sub
- Sub SportsClub()
- Dim Membership As String
- Dim Subscription As String
- Dim Age As Integer
- Dim Years As Integer
- Console.WriteLine("Please input your age")
- Age = Console.ReadLine()
- Console.WriteLine("Please input the number of years you have been a member for")
- Years = Console.ReadLine()
- If Age <= 18 Then
- Membership = "Junior"
- Subscription = "£60 per year"
- ElseIf Age > 18 And Age < 50 Then
- Membership = "Senior"
- Subscription = "£120 per year"
- ElseIf Age >= 50 Then
- Membership = "Veteran"
- Subscription = "£80 per year"
- End If
- If Membership = "Junior" And Years >= 2 Then
- Subscription = "£40 per year"
- ElseIf Membership = "Senior" And Years >= 10 Then
- Subscription = "£90 per year"
- End If
- Console.WriteLine("Your membership is " & Membership)
- Console.WriteLine("Your Subscription is " & Subscription)
- Console.ReadKey()
- End Sub
- Sub RockPaperScissors()
- Dim UserInput As Integer
- Dim RandBotGuess As Integer = Int(Rnd() * 3) + 1
- Dim PlayAgain As String
- Console.WriteLine("Rock. Paper or Scissors? (1, 2 or 3)")
- UserInput = Console.ReadLine()
- Console.WriteLine()
- Console.WriteLine("You Guessed " & UserInput)
- Console.WriteLine("The Bot Guessed " & RandBotGuess)
- Console.WriteLine()
- If UserInput = 1 And RandBotGuess = 3 Then
- Console.WriteLine("You Win!")
- ElseIf UserInput = 2 And RandBotGuess = 1 Then
- Console.WriteLine("You Win!")
- ElseIf UserInput = 3 And RandBotGuess = 2 Then
- Console.WriteLine("You win!")
- ElseIf UserInput = RandBotGuess Then
- Console.WriteLine("Draw!")
- Else
- Console.WriteLine("The Bot Wins!")
- End If
- Console.WriteLine("Would you like to play again? (y/n)")
- PlayAgain = Console.ReadLine()
- If PlayAgain = "y" Then
- RockPaperScissors()
- End If
- End Sub
- Sub LogicGates()
- Dim UserInput As String
- Dim FirstInput As Integer
- Dim SecondInput As Integer
- Dim Result As Integer = 0
- Dim RunAgain As String
- Console.WriteLine("Please input the logic gate you wish to use (OR, AND or XOR)")
- UserInput = Console.ReadLine()
- Console.WriteLine("Please Enter the first input")
- FirstInput = Console.ReadLine()
- Console.WriteLine("Please enter the sencond input")
- SecondInput = Console.ReadLine()
- If UserInput = "OR" Then
- If FirstInput Or SecondInput = 1 Then
- Result = 1
- End If
- End If
- If UserInput = "AND" Then
- If FirstInput = 1 And SecondInput = 1 Then
- Result = 1
- End If
- End If
- If UserInput = "Xor" Then
- If FirstInput = 1 And SecondInput = 0 Then
- Result = 1
- ElseIf FirstInput = 0 And SecondInput = 1 Then
- Result = 1
- End If
- End If
- Console.WriteLine("Result = " & Result)
- Console.WriteLine("Would you like to run this program again? (y/n)")
- RunAgain = Console.ReadLine()
- If RunAgain = "y" Then
- LogicGates()
- End If
- End Sub
- Sub AdvancedNumerals()
- Dim UserInput As Integer
- Dim Numeral As String
- Dim NumLen As Integer
- Console.WriteLine("Please input a number between 1-50 that you would like to convert into roman numerals")
- UserInput = Console.ReadLine()
- NumLen = Len(UserInput)
- For i = 1 To NumLen
- Select Case UserInput
- Case 1
- Numeral = "I"
- Case 5
- Numeral = "V"
- Case 10
- Numeral = "X"
- Case 50
- Numeral = "L"
- End Select
- Next
- End Sub
- End Module
Advertisement
Add Comment
Please, Sign In to add comment