-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFlight Statistics Calculator.vb
34 lines (32 loc) · 1.37 KB
/
Flight Statistics Calculator.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Module Module1
Sub Main()
Dim Flights As Integer
Dim FlightID As String
Dim FlightsFastair As Integer = 0
Dim FlightsSwiftjet As Integer = 0
Dim FlightsKnightair As Integer = 0
Dim Count As Integer = 0
Dim PercentFastair As Decimal
Dim PercentSwiftjet As Decimal
Dim PercentKnightair As Decimal
Console.WriteLine("Input the flight identification")
For Flights = 1 To 5
FlightID = Console.ReadLine()
Count = Count + 1
If FlightID = "FA" Then
FlightsFastair = FlightsFastair + 1
ElseIf FlightID = "SJ" Then
FlightsSwiftjet = FlightsSwiftjet + 1
ElseIf FlightID = "KA" Then
FlightsKnightair = FlightsKnightair + 1
End If
Next
PercentFastair = FlightsFastair / Count * 100
PercentSwiftjet = FlightsSwiftjet / Count * 100
PercentKnightair = FlightsKnightair / Count * 100
Console.WriteLine("The percentage of flights that were from FastAir is %" & PercentFastair)
Console.WriteLine("The percentage of flights that were from SwiftJet is %" & PercentSwiftjet)
Console.WriteLine("The percentage of flights that were from KnightAir is %" & PercentKnightair)
Console.ReadLine()
End Sub
End Module