Пример #1
0
def execute():
    utils.print_center(title=' COMMON STRING OPERATIONS ')

    print_helper("JOIN",           do_join,       'Yellow', 'Lemon', 'Tree')
    print_helper("SPLIT",          do_split,      'ONE:TWO:THREE', ':')
    print_helper("SUBSTRING",      do_substr,     'OneManShow', start=3, end=6)
    print_helper("SUBSTRING",      do_substr,     'OneManShow', start=3)
    print_helper("SUBSTRING",      do_substr,     'OneManShow', end=3)
    print_helper("SUBSTRING",      do_substr,     'OneManShow')
    print_helper("INDEXOF",        do_find,       'OneManShow', 'Man')
    print_helper("LEN",            do_len,        'OneManShow')
    print_helper("REPLACE",        do_replace,    'One1Man1Show', '1', '=')
    print_helper("REPEAT",         do_repetition, 'ONE.', 5)
    print_helper("CONCAT",         do_concat,     'one', 'TWO', 'three', 'FOUR')
    #print_helper("FORMAT",         do_format,     'one', 'TWO', 'three', 'FOUR')
    print_helper("ISALPHA",        do_eval,       'isAlpha', 'ONE')
    print_helper("ISALPHA",        do_eval,       'isAlpha', '1')
    print_helper("ISALPHANUM",     do_eval,       'isAlphaNum', 'ONE')
    print_helper("ISALPHANUM",     do_eval,       'isAlphaNum', 'ONE@')
    print_helper("ISNUM",          do_eval,       'isNumeric', 'ONE')
    print_helper("ISNUM",          do_eval,       'isNumeric', '12')
    print_helper("STARTSWITH",     do_eval,       'startsWith', 'YellowTree', param='Yell')
    print_helper("STARTSWITH",     do_eval,       'endsWith', 'YellowTree', param='ree')
    print_helper("SWAP",           do_case,       'SWAP','BOooGeYMaN')
    print_helper("TITLE",          do_case,       'TITLE', 'THE hunger GAMES')
    print_helper("UPPER",          do_case,       'UPPER', 'onetwo')
    print_helper("LOWER",          do_case,       'LOWER', 'ONETWO')
    print_helper("LEFT",           do_align,      'LEFT', 'ONE', 10, fill='*')
    print_helper("RIGHT",          do_align,      'RIGHT', 'ONE', 10, fill='*')
    print_helper("CENTER",         do_align,      'CENTER', 'ONE', 10, fill='*')
    print_helper("LTRIM",          do_trim,       'LEFT', '***ONE***', pad='*')
    print_helper("RTRIM",          do_trim,       'RIGHT', '***ONE***', pad='*')
    print_helper("TRIM",           do_trim,       'BOTH', '***ONE***', pad='*')
Пример #2
0
def execute():
    utils.print_center(title=' EXERCISES ')
    exer_sequences(['A', 'B', 'C'], 3)
    exer_conditionals()
    exer_functions()
    exer_classes()
    exer_exceptions()
Пример #3
0
    def gerar_extrato(self, conta, cliente):
        self.cabecalho_tela(conta, cliente)
        print_center("Extrato de movimentacoes\n")

        conta.extrato()
        raw_input("\n\nPressione [ENTER] para voltar ao menu.")
        return
def execute():
    utils.print_center(title=" REGULAR EXPRESSIONS ")
    basic_regular_expressions()
    quantifiers()
    grouping()
    replace_strings()
    split_strings()
Пример #5
0
    def registrar_movimentacao(self, conta, cliente):
        self.cabecalho_tela(conta, cliente)
        print_center("Registro de movimentacoes\n")

        tipo_operacao = raw_input(
            "Deseja fazer um [D]eposito ou um [S]aque? ")[:1]
        if ((tipo_operacao.upper() != "D") and (tipo_operacao.upper() != "S")):
            raw_input("\nTipo de operacao selecionado e invalido!")
            return
        valor_operacao = float(
            raw_input("Qual valor a ser movimentado? $ ")[:15])
        if (valor_operacao <= 0):
            raw_input("\nValor para a operacao e invalido!")
            return

        if ((tipo_operacao.upper() == "D")):
            conta.deposito(valor_operacao)
        elif ((tipo_operacao.upper() == "S")):
            conta.saque(valor_operacao)

        # persistir dados
        self.store()

        self.cabecalho_tela(conta, cliente)
        print_center("Registro de movimentacoes\n")
        raw_input("\n Operacao realizada com sucesso!")
        return
Пример #6
0
 def cabecalho_tela(self, conta, cliente):
     limpar_tela()
     print_center("DETALHAMENTO DE CONTA")
     print("-" * 80)
     print("CONTA SELECIONADA.: [ {:6d} ]".format(conta.getNumero()) +
           " " * 18 +
           "SALDO ATUAL: $ [ {:12.2f} ]".format(conta.getSaldoDisponivel()))
     print("PROPRIETARIO......: [ {:55s} ]".format(cliente.getNome()))
     print("-" * 80 + "\n")
Пример #7
0
    def nova_conta(self):
        print_center("Cadastrar nova conta\n")
        print_center("=" * 80)

        nome_cliente = None
        telefone_cliente = None
        tipo_cliente = None
        limite_cliente = 0

        nome_cliente = raw_input("Nome do cliente: ")[:50].strip().upper()
        if (len(nome_cliente) <= 3):
            raw_input("\nO nome informado e invalido!")
            return
        telefone_cliente = raw_input("Num. telefone: ")[:15].strip()
        if (len(telefone_cliente) <= 8):
            raw_input("\nO telefone informado e invalido!")
            return

        tipo_cliente = raw_input(
            "Qual a categoria deste cliente? [C]omun ou [E]special: "
        )[:1].strip().upper()
        if ((tipo_cliente != "C") and (tipo_cliente != "E")):
            raw_input("\nO tipo informado e invalido!")
            return
        if (tipo_cliente == "E"):
            limite_cliente = float(
                raw_input("Qual limite bancario deste cliente? $ ")
                [:15].strip())
            if ((limite_cliente <= 0) or (limite_cliente > 10000)):
                raw_input(
                    "\nO limite informado e invalido (o max. permitido e $ 10.000)!"
                )
                return

        novo_cliente = Cliente(nome=nome_cliente, telefone=telefone_cliente)
        num_cadastro_cliente = novo_cliente.getID()
        if (tipo_cliente == "C"):
            nova_conta = Conta(cliente_id=num_cadastro_cliente)
        elif (tipo_cliente == "E"):
            nova_conta = ContaEspecial(cliente_id=num_cadastro_cliente)
            nova_conta.limite(limite_cliente)

        self._dataset["CLIENTES"].append(novo_cliente)
        self._dataset["CONTAS"].append(nova_conta)

        # persistir dados
        self.store()

        self.cabecalho_tela(nova_conta, novo_cliente)
        print_center("Cliente cadastrado com sucesso!\n\n")
        print_center("Codigo de cliente: {:8d}".format(
            nova_conta.getClienteID()))
        print_center("Numero conta: {:8d}\n\n\n".format(
            nova_conta.getNumero()))

        raw_input("\nPressione [ENTER] para voltar ao menu.")
        return
Пример #8
0
 def extrato(self):
     print_center("=" * 77)
     print_center("| {:15s} | {:12s} | {:25s} | {:12s} |".format(
         "OPERACAO", "VALOR ($)", "STATUS", "SALDO ($)"))
     print_center("|-{:15s}-+-{:12s}-+-{:25s}-+-{:12s}-|".format(
         "-" * 15, "-" * 12, "-" * 25, "-" * 12))
     for evento in self._historico:
         print_center(evento)
     print_center("=" * 77)
def execute():
    # lists
    utils.print_center(title=' COMMON LIST OPERATIONS ')
    sequence_operations()
    list_methods()
    list_func()
    list_stack()
    list_queue()
    list_comprehensions()
    list_set()

    utils.print_center(title=' COMMON DICT OPERATIONS ')
    dict_methods()
Пример #10
0
def entrar_menu_conta():
    limpar_tela()
    print_center("MENU DE CONTA\n")
    conta = None
    try:
        num_conta = int(raw_input("Informe o numero da conta: "))
    except:
        num_conta = 0

    conta = banco.selecionarConta(num_conta)
    if (conta is not None):
        print(conta)
        banco.menu_conta()
    return
Пример #11
0
    def alterar_limite(self, conta, cliente):
        self.cabecalho_tela(conta, cliente)
        print_center("Alteracao de limites\n")
        if (type(conta) is not ContaEspecial):
            print_center(
                "Esta conta nao possui esta opcao de alteracao de limites!")
            raw_input("\n\nPressione [ENTER] para voltar para o menu.")
            return

        valor_limite = float(raw_input("Qual valor do novo limite? $ ")[:15])
        if (valor_limite < 0):
            raw_input("\nValor para a operacao e invalido!")
            return

        conta.limite(valor_limite)

        # persistir dados
        self.store()

        self.cabecalho_tela(conta, cliente)
        print_center("Alteracao de limites\n")
        print_center("Operacao realizada com sucesso!")
        raw_input("\n\nPressione [ENTER] para voltar para o menu.")
        return
Пример #12
0
def execute():
    print_center(title="CLASS DEMO")
    demo_class()
    demo_inheritance()
Пример #13
0
 def listar_contas(self):
     print_center("Relatorio das contas cadastradas")
     print_center("=" * 73)
     print_center("| {:6s} | {:30s} | {:12s} | {:12s} |".format(
         "COD", "NOME DO CLIENTE", "NUM. CONTA", "SALDO DISP."))
     print_center("|-{:6s}-+-{:30s}-+-{:12s}-+-{:12s}-|".format(
         "-" * 6, "-" * 30, "-" * 12, "-" * 12))
     for conta in self._dataset["CONTAS"]:
         cliente = self.findClienteByID(conta.getClienteID())
         print_center("| {:6d} | {:30s} | {:12d} | {:12.2f} |".format(
             cliente.getID(), cliente.getNome(), conta.getNumero(),
             conta.getSaldoDisponivel()))
     print_center("=" * 73)
     return
Пример #14
0
def execute():
    utils.print_center(title=' FILES ')
    file_operations()
Пример #15
0
def execute():
    print_center(title="JAVA INTEGRATION")
    java_swing()

    java_option_pane()