Using conditional statements design a login where a user will enter a username and password
A) on successful login a welcome message is displayed
B) on 3 attempts an invalid message is displayed informing the user of the attempts remaining
C)on the fourth unsuccessful attempt the program will exit and inform the user of failed attempts
Imports System.IO
Module Module1
Sub Main()
Dim attempts As Integer = 0
While attempts < 4
Console.Write("Enter username: ")
Dim username As String = Console.ReadLine()
Console.Write("Enter password: ")
Dim password As String = Console.ReadLine()
If username = "admin" And password = "1111" Then
Console.WriteLine("You're Welcome")
attempts = 5
Else
attempts += 1
Console.WriteLine("Wrong username or password.")
End If
If attempts = 3 Then
Console.WriteLine("Wrong username or password. 1 attempts remaining")
End If
End While
If attempts <> 5 Then
Console.WriteLine("4 failed attempts")
End If
Console.ReadLine()
End Sub
End Module
Comments
Leave a comment