Dim Digit1, Digit2, Digit3, Digit4, Digit5 As Integer
Dim Check_digit as Integer
Dim Arrival_time as Integer
Dim Frequent_parking_no as Integer
Dim Hours_stay as Integer
Dim Price_per_hour as Integer
console.WriteLine("Please input Arrival time in only hours. Eg: if arrival is at 15:45 then input 15")
Arrival_time = console.ReadLine()
If Arrival_time < 8 or Arrival_time > 24 Then
console.WriteLine("This entry is invalid as parking is not available. Please enter a correct value")
Elseif Arrival_time < 16 Then
console.WriteLine("Please input the day of the week as an integer. Eg: 1 = sunday , 2 = monday ,etc.")
Week_day = console.ReadLine()
Elseif Week_day > 1 and Week_day < 7 Then
console.WriteLine("Entry is Invalid. The number must be between 1 and 7")
Loop until Week_day > 0 and Week_day < 8
Elseif Arrival_time > 15 Then
console.WriteLine("Please input the day of the week as an integer. Eg: 1 = sunday , 2 = monday ,etc.")
Week_day = console.ReadLine()
If Week_day > 0 and Week_day < 8 Then
Max_stay = 24 - Arrival_time
console.WriteLine("Entry is Invalid. The number must be between 1 and 7")
Loop until Week_day > 1 and Week_day < 8
console.WriteLine("Please enter a valid arrival time. Please input Arrival time in only hours. Eg: if arrival is at 15:45 then input 15")
loop until Arrival_time > 7 and Arrival_time < 25
console.WriteLine("Please enter the amount of hours you wish to stay")
console.WriteLine("Note that you can only stay for " & Max_stay & " Hours")
Hours_stay = console.ReadLine()
If Hours_stay > Max_stay then
console.WriteLine("The value entered exceeds the maximum limit please try again")
Loop until Hours_stay <= Max_stay
Console.WriteLine("If you have a frequent parking number,please enter 1, otherwise enter any other number")
Frequent_parking_no = Console.ReadLine()
If Frequent_parking_no <> 1 Then
Console.WriteLine("You will receive no discount")
ElseIf Frequent_parking_no = 1 Then
Console.WriteLine("Please enter your code")
Frequent_parking_no = Console.ReadLine
Digit1 = Frequent_parking_no Mod 10
Digit2 =(Frequent_parking_no Mod 100 - Frequent_parking_no Mod 10) / 10
Digit3 =(Frequent_parking_no Mod 1000 - Frequent_parking_no Mod 100) / 100
Digit4 =(Frequent_parking_no Mod 10000 - Frequent_parking_no Mod 1000) / 1000
Digit5 =(Frequent_parking_no Mod 100000 - Frequent_parking_no Mod 10000) / 10000
Check_digit = 11 - ((Digit5 * 6 + Digit4 * 5 + Digit3 * 4 + Digit2 * 3 + Digit1 * 2) Mod 11)
If Check_digit = Digit1 Then
If Arrival_time >= 16 Then
Console.WriteLine("Discount number is verified. You have received a 50% discount!")
Console.WriteLine("DIscount number is verified You have received a 10% discount!")
Console.WriteLine("Discount number is invalid. Please try again")
Price = Price_per_hour * Hours_Stay * (1 - Discount)
Console.WriteLine("The Price to park will be " & Price & "$")
Console.WriteLine("The Arrival time was " & Arrival_time)
Console.WriteLine("The Hours you wish to stay are " & Hours_stay)
Console.WriteLine("The Discount is " & (Discount * 100) & "%")