Ejemplo n.º 1
0
    def mainMenu(self):
        file = 'PastFlights copy.csv'
        originalFlights = read_pastFlights(file)
        destinations = getDestinations()
        newFlights = fixFlNo(originalFlights, destinations)
        updateFlights(newFlights, file)
        file = 'UpcomingFlights copy3.csv'
        originalFlights = read_pastFlights(file)
        destinations = getDestinations()
        newFlights = fixFlNo(originalFlights, destinations)
        updateFlights(newFlights, file)

        print_ = pagePrints(100, 40)
        print_.frontPage()  #'c', 'g', 'u'
        inp = input()
        if inp == "c":
            self.create(print_)
        elif inp == 'g':  #Get information
            self.getInformation(print_)  #Staff,airplanes,voyage,destinations
        elif inp == 'u':
            self.updateInformation(print_)
Ejemplo n.º 2
0
    def getDestinationsInfo(self, print_):
        print_.window20()
        inp = int(input("Number: "))
        if inp == 1:
            listOfDest = getDestinations()
            for i in range(len(listOfDest)):
                print(listOfDest[i].id + ' - ' + listOfDest[i].destination)

        elif inp == 2:
            mostpop = MostPopularDestination()
            destList = getDestinations()
            popInfo = mostPOPinfo(mostpop, destList)

            print('The most popular destination is: ',
                  popInfo.destination.upper())
            print('Airport: ' + popInfo.id + '\n' + 'Country: ' +
                  popInfo.country + '\n' + 'Distance from Iceland: ' +
                  popInfo.distance + '\n' + 'Destination contact: ' +
                  popInfo.contactName + ' - tel: ' + popInfo.contactNumber)

        elif inp == 0:
            self.getInformation(print_)
Ejemplo n.º 3
0
 def DLairportOccupied(self, newVoyage):
     newVoyList = airportOccupied(
         newVoyage
     )  #saekir lista af vinnuferdum, vistar nyja ef flugvollur er ekki occupied
     destinations = getDestinations()  #saekir alla afangastadi
     return newVoyList, destinations
def MostPopularDestination():

    dest_arr = []
    pastFlights_array = []
    upcFlights_array = []
    PopularDest = []

    #path='/Users/SaraLind/github/verklegt_namskeid_1/csvFiles/'

    ########### open file 1 ###########
    skra1 = 'DestinationsCopy.csv'
    file1 = OpenFile(skra1)
    allDest = getDestinations()

    #by til lista af öllum destination sem eru ekki KEF
    for i in range(len(allDest)):
        if allDest[i].id != 'KEF':
            Destination = allDest[i].id
            dest_arr.append(Destination)
    length = len(dest_arr)

    ########### open file 2 ###########
    skra2 = 'PastFlights copy.csv'
    #file2 = OpenFile(skra2)

    allPastFlights = read_pastFlights(skra2)
    #by til lista af öllum destination ur pastflights
    for i in range(len(allPastFlights)):
        if allPastFlights[i].departingFrom == 'KEF':
            pastFlights = allPastFlights[i].arrivingAt
            pastFlights_array.append(pastFlights)

    ########### open file 3 ###########
    skra3 = 'UpcomingFlights copy3.csv'

    allUPcFlights = read_pastFlights(skra3)
    #by til lista af öllum destination ur upcomingflights
    for i in range(len(allUPcFlights)):
        if allUPcFlights[i].departingFrom == 'KEF':
            upcFlights = allUPcFlights[i].arrivingAt
            upcFlights_array.append(upcFlights)

    ########### Find the most popular destination ###########
    #set saman listana
    PopularDest = pastFlights_array + upcFlights_array

    counter = []
    largest = 0
    TheCounter = 0
    count = 0

    for i in range(length):
        counter.append(0)

    #fer gegnum allt til að finna hvaða afangastaður kemur oftast fyrir
    for i in range(length - 1):
        for j in range(len(PopularDest)):
            if dest_arr[i] == PopularDest[j]:
                counter[i] += 1
    #Find the largest value
    for i in range(length - 1):
        if counter[i] > largest:
            largest = counter[i]

    #Find the location of biggest value
    for i in range(length - 1):
        if counter[i] == largest:
            count = TheCounter
        TheCounter += 1

    #Find the most popular destination
    mostPopular = dest_arr[count]

    return mostPopular
Ejemplo n.º 5
0
    def addUpdRouteInp(self, voyage):
        destinations = getDestinations()
        aircraft = list_all_aircraft()
        self.flightNumber = voyage.flightNumber
        self.captain = voyage.captain
        self.copilot = voyage.copilot
        self.fsm = voyage.fsm
        self.fa1 = voyage.fa1
        self.fa2 = voyage.fa2
        self.departingFrom = voyage.departingFrom
        self.arrivingAt = voyage.arrivingAt
        self.departure = voyage.departure
        self.arrival = voyage.arrival
        self.aircraftId = voyage.aircraftId

        #print(self.aircraftId)

        for plane in aircraft:
            if plane.planeInsignia == self.aircraftId:
                capacity = plane.capacity

        #print(capacity)

        validSold_bool = 0
        while not validSold_bool:
            self.soldTickets = input("Amount of sold seats outbound: ")
            if self.soldTickets == "CANCEL":
                validSold_bool = 1
                return 0
            elif int(self.soldTickets) > int(capacity):
                print(
                    'Invalid input. Amount of sold seats exceeds plane capacity'
                )
                print('Airplane capacity: ' + capacity)
            elif int(self.soldTickets) < 0 or self.soldTickets == '':
                print('Please enter an amount in the range 0-' + capacity)
            elif not self.soldTickets.isdigit():
                print(
                    'Invalid input. Amount must consist of integers only [0-9]'
                )
            else:
                validSold_bool = 1

        validSold2_bool = 0
        while not validSold2_bool:
            outTick = input("Amount of sold seats homebound: ")
            if outTick == "CANCEL":
                validSold2_bool = 1
                return 0
            elif int(outTick) > int(capacity):
                print(
                    'Invalid input. Amount of sold seats exceeds plane capacity'
                )
                print('Airplane capacity: ' + capacity)
            elif int(outTick) < 0 or outTick == '':
                print('Please enter an amount in the range 0-' + capacity)
            elif not outTick.isdigit():
                print(
                    'Invalid input. Amount must consist of integers only [0-9]'
                )
            else:
                validSold2_bool = 1

        #print(outTick)

        return self, outTick
Ejemplo n.º 6
0
 def LLupdateDestination(self):
     destination=getDestinations() #saekir alla afangastadi
     return destination