Example #1
0
 def use9(self):
     '''
     We multiply two complex numbers
     '''
     c1 = ComplexNumber(user_input(), user_input())
     print('We multiply two complex numbers:')
     l = self.__repo.iterate()
     for i in range(len(l)):
         print('For the number : ', l[i])
         print("The result is: ", l[i].multiplyNumbers(c1))
         l[i] = l[i].multiplyNumbers(c1)
     print(".....................................................")
Example #2
0
 def use11(self):
     '''
     We get the number at a given power
     '''
     l = self.__repo.iterate()
     p = user_input()
     for i in range(len(l)):
         print('The number: ', l[i], 'at the power ', p, 'is:')
         l[i] = l[i].powerComplex(p)
         print(l[i])
     print(".....................................................")
Example #3
0
 def menu(self):
     self.__ctrl.read_nr('numbers.txt')
     while True:
         ComplexNumberMenu.printMenu()
         command = user_input()
         if command == -2:
             self.__ctrl.useclear()
         if command == -1:
             self.__ctrl.createNumber(user_input(), user_input())
         elif command == 0:
             exit()
         elif command == 1:
             self.__ctrl.use1()
         elif command == 2:
             self.__ctrl.use2()
         elif command == 3:
             self.__ctrl.use3()
         elif command == 4:
             self.__ctrl.use4()
         elif command == 5:
             self.__ctrl.use5()
         elif command == 6:
             self.__ctrl.use6()
         elif command == 7:
             self.__ctrl.use7()
         elif command == 8:
             self.__ctrl.use8()
         elif command == 9:
             self.__ctrl.use9()
         elif command == 10:
             self.__ctrl.use10()
         elif command == 11:
             self.__ctrl.use11()
         elif command == 12:
             self.__ctrl.use12()
         elif command == 13:
             self.__ctrl.use13()
 def menu(self):
     plane = Planes(string_input(),string_input(),string_input(),user_input(),string_input(),[])
     self.__ctrl.addPlane(plane)
     while True:
         PlanesMenu.printMenu()
         command = user_input()
         if command == -4:
             self.__ctrl.deletePlane(user_input())
         elif command == -3:
             self.__ctrl.deletePassengerinPlane(user_input(),string_input(),string_input())
         elif command == -2:
             plane = Planes(string_input(),string_input(),string_input(),user_input(),string_input(),[])
             self.__ctrl.addPlane(plane)
         elif command == -1:
             self.__ctrl.addPassengerinPlane(string_input(),string_input(),string_input(),string_input(),string_input())
         elif command == 0:
             exit()
         elif command == 1:
             print(self.__ctrl.listPlane())
         elif command == 2:
             self.__ctrl.sortbyLastName()
             print(self.__ctrl.listPlane())
         elif command == 3:
             self.__ctrl.sortbyletter(string_input())
         elif command == 4:
             self.__ctrl.sortbyconcatenation()
         elif command == 5:
             l = self.__ctrl.find_by_nr()
             print(l)
         elif command == 6:
             l = self.__ctrl.find_by_str(user_input(),string_input())
             print(l)
         elif command == 7:
             l = self.__ctrl.find_by_name(string_input(),string_input())
             print(l)
         elif command == 8:
             self.__ctrl.form1(user_input())
         elif command == 9:
             self.__ctrl.form2(user_input())
         else:
             print('Not a valid option')
Example #5
0
 def use7(self):
     '''
     We multiply the complex numbers by a given imaginary number
     '''
     try:
         n = user_input()
         l = self.__repo.iterate()
         f = open('Rez.txt', 'a')
         for i in range(len(l)):
             f.write(str(l[i].multiplyImag(n)))
             l[i] = l[i].multiplyImag(n)
             f.write('\n')
         f.write(
             'These were the numbers multiplyed by a given imaginary number'
         )
         f.close()
     except:
         print('Error while writing the file')
         exit()