Private PlaneType() as string= {"2 seater", "4 seater" , "historic"}
Private numFlights as integer = 0
Private flightlength as integer
Private totalincome as decimal = 0
Private Planenum as decimal
Private PRICE_2seater(1) as decimal
Private PRICE_4seater(1) as decimal
Private PRICE_historic(1) as decimal
dim priceIndex as integer
Private mins as integer = 630
Console.WriteLine("input plane type. '1' for 2 seater, '2' for 4 seater, '3' for historic")
Planenum = console.ReadLine()
do while Planenum <1 or Planenum >3
Console.WriteLine("invalid plane type.'1' for 2 seater, '2' for 4 seater, '3' for historic")
Planenum = console.ReadLine()
Console.WriteLine("input flight length. 30 or 60 minutes")
flightlength = console.ReadLine()
do while flightlength <> 30 and flightlength <> 60
Console.WriteLine("invalid flight length.please enter 30 or 60 minutes")
flightlength = console.ReadLine()
flightlength = flightlength+30
numFlights = mins / flightlength
numFlights = Math.Floor(numFlights)
PriceIndex= (flightlength/30)-2
totalincome = PRICE_2Seater(priceIndex) * numFlights
totalincome = PRICE_4Seater(priceIndex) * numFlights
totalincome = PRICE_historic(priceIndex) * numFlights
console.writeline("max number of flights = " & numFlights)
console.writeline("total income for chosen plane = $"& totalincome)
Dim nbookings_2Seater(numFlights) As integer
Dim nbookings_4Seater(numFlights) As integer
Dim nbookings_historic(numFlights) As integer
Dim iAircraftType As Integer
Dim bookingslot As Integer
console.writeline("booking")
console.writeline("input plane type. '1' for 2 seater, '2' for 4 seater, '3' for historic. '-1' to end booking")
iAircraftType = console.ReadLine()
Do While iAircraftType <> -1
Select Case iAircraftType
Do While bookingslot <> -1
Console.WriteLine("Enter a booking slot between 1 and {0} for 2 seater. Enter -1 to stop entering bookings for this plane", numFlights)
bookingslot = console.readline()
If bookingslot <> -1 then
Do Until (bookingslot >= 1 And bookingslot <= numFlights)
Console.WriteLine("Invalid number entered. Enter a booking slot between 1 and {0} for 2 seater.", numFlights)
bookingslot = Console.ReadLine()
If nbookings_2Seater(bookingslot) <> 1 Then
nbookings_2Seater(bookingslot) = 1
Console.WriteLine("Booking slot {0} booked", bookingslot)
Console.WriteLine("Booking slot{0} already booked. Please enter a valid slot", bookingslot)
Do While bookingslot <> -1
Console.WriteLine("Enter a booking slot between 1 and {0} for 4 seater. Enter -1 to end bookings for this plane", numFlights)
bookingslot = console.readline()
If bookingslot <> -1 then
Do Until (bookingslot >= 1 And bookingslot <= numFlights)
Console.WriteLine("Invalid number entered. Enter a booking slot between 1 and {0} for 4 seater. ", numFlights)
bookingslot = Console.ReadLine()
If nbookings_4Seater(bookingslot) <> 1 Then
nbookings_4Seater(bookingslot) = 1
Console.WriteLine("Booking slot {0} booked", bookingslot)
Console.WriteLine("Booking slot{0} already booked. Please enter a valid slot", bookingslot)
Do While bookingslot <> -1
Console.WriteLine("Enter a booking slot between 1 and {0} for historic. Enter -1 to stop entering bookings for this plane", numFlights)
bookingslot = console.readline()
If bookingslot <> -1 then
Do Until (bookingslot >= 1 And bookingslot <= numFlights)
Console.WriteLine("Invalid number entered. Enter a booking slot between 1 and {0} for historic.", numFlights)
bookingslot = Console.ReadLine()
If nbookings_historic(bookingslot) <> 1 Then
nbookings_historic(bookingslot) = 1
Console.WriteLine("Booking slot {0} booked", bookingslot)
Console.WriteLine("Booking slot{0} already booked. Please enter a valid slot", bookingslot)
Console.WriteLine("Enter Aircraft type, 1 for 2 seater, 2 for 4 seater, 3 for Historic. Enter -1 to stop entering all bookings")
iAircraftType = Console.ReadLine()
Dim flightincome (3)as integer
dim totalflights(3) as integer
For iAircraftType = 1 to 3
Select case iAircraftType
totalflights(iAircraftType) = totalflights(iAircraftType) + nbookings_2Seater(i)
flightincome(iAircraftType) = totalflights(iAircraftType) * PRICE_2seater(priceIndex)
totalflights(iAircraftType) = totalflights(iAircraftType) + nbookings_4Seater(i)
flightincome(iAircraftType) = totalflights(iAircraftType) * PRICE_4seater(priceIndex)
totalflights(iAircraftType) = totalflights(iAircraftType) + nbookings_historic(i)
flightincome(iAircraftType) = totalflights(iAircraftType) * PRICE_historic(priceIndex)
console.writeline(" total no of flights for 2 seater is " & totalflights(1) )
console.writeline(" total no of flights for 4 seater is " & totalflights(2) )
console.writeline(" total no of flights for historic is " & totalflights(3) )
console.writeline("income ")
console.writeline("plane {0} is {1} " , PlaneType(i) , flightincome(i) )
console.writeline("total income= $" & flightincome(1) + flightincome(2) + flightincome(3))