Exemple #1
0
def main():
    login = userLogin()
    user = login.getUser()
    interface = GraphicInterface()
    app = ATM(user, interface)
    app.run()
    interface.closeInterface()
Exemple #2
0
class TestValidation(TestCase):
    def setUp(self):
        self.atm = ATM(100)

    def test_good_card_validation(self):
        card = mocked_card()
        self.atm.validate_card(card, sentinel.pin_code)

        #card.check_pin.assert_called_once_with(sentinel.pin_code)
        self.assertEqual(self.atm.card, card)

    def test_blocked_card_validation(self):
        card = mocked_card(blocked=True)
        self.atm.validate_card(card, ANY)

        card.check_pin.assert_not_called()
        self.assertIsNone(self.atm.card)
        self.test_no_card_inserted()

    def test_wrong_pin_validation(self):
        card = mocked_card(pin=False)
        self.atm.validate_card(card, sentinel.pin_code)

        #card.check_pin.assert_called_once_with(sentinel.pin_code)
        self.assertIsNone(self.atm.card)
        self.test_no_card_inserted()

    def test_no_card_inserted(self):
        with self.assertRaises(NoCardInserted):
            self.atm.card_balance()
        with self.assertRaises(NoCardInserted):
            self.atm.get_money(100)
Exemple #3
0
def lineto(pt, done_moveto):
	x, y = pt
	if done_moveto:
		ATM.fillLineToATM((x, y))
	else:
		ATM.fillMoveToATM((x, y))
	return pt
Exemple #4
0
def lineto(pt, done_moveto):
    x, y = pt
    if done_moveto:
        ATM.fillLineToATM((x, y))
    else:
        ATM.fillMoveToATM((x, y))
    return pt
Exemple #5
0
def Person():
    try:
        with open('./card/%s.json' % USER, 'r') as cr:
            print('====================')
    except:
        with open('./card/%s.json' % USER, 'w') as c:
            da = {}
            json.dump(da, c)
    while user_state == True:
        UPWD = './user/%s.json' % USER
        with open(UPWD, 'r') as f:
            user_info = json.load(f)
        print('--------%s---------\n' % USER)
        print('1.我的余额')
        print('2.我的卡包')
        print('3.添加信用卡')
        print('4.修改密码')
        print('5.转账')
        print('6.提现')
        print('0.退出')
        choose = int(input('你的操作:'))
        if choose == 1:
            print('你的余额为:', user_info['money'])
        elif choose == 2:
            print('')
            try:
                with open('./card/%s.json' % USER, 'r') as c:
                    print(json.load(c))
                #     c_o = json.load(c)['test']
                #     print(c_o)
                # for i in c_o:
                #     print(i,)
            except:
                print('你还没有没有卡....')
                with open('./card/%s.json' % USER, 'w') as c:
                    da = {123: 123}
                    json.dump(da, c)
                continue
        elif choose == 3:
            Add_card()
        elif choose == 4:
            user_info['password'] = input('请输入你的新密码:')
            data = user_info
            with open(UPWD, 'w') as f:
                json.dump(data, f)
        elif choose == 5:
            ATM.zhuanzhang(USER, PASSWD, user_state)
        elif choose == 6:
            try:
                with open(UPWD, 'w') as f:
                    user_info['money'] = 0
                    json.dump(user_info, f)
                    print('提现成功!')
            except:
                print('提现失败!')
        elif choose == 0:
            break
        else:
            print("输入错误")
Exemple #6
0
def qcurveto(pt0, pt1, pt2, done_moveto):
	if not done_moveto:
		x0, y0 = pt0
		ATM.fillMoveToATM((x0, y0))
	x1a, y1a = pt0 + 0.6666666666667 * (pt1 - pt0)
	x1b, y1b = pt2 + 0.6666666666667 * (pt1 - pt2)
	x2, y2 = pt2
	ATM.fillCurveToATM((x1a, y1a), (x1b, y1b), (x2, y2))
	return pt2
Exemple #7
0
def qcurveto(pt0, pt1, pt2, done_moveto):
    if not done_moveto:
        x0, y0 = pt0
        ATM.fillMoveToATM((x0, y0))
    x1a, y1a = pt0 + 0.6666666666667 * (pt1 - pt0)
    x1b, y1b = pt2 + 0.6666666666667 * (pt1 - pt2)
    x2, y2 = pt2
    ATM.fillCurveToATM((x1a, y1a), (x1b, y1b), (x2, y2))
    return pt2
Exemple #8
0
class TestOperation(TestCase):
    def setUp(self):
        self.atm = ATM(500)
        account = mocked_account(balance=700)
        card = mocked_card(account=account)
        self.atm.validate_card(card, ANY)

    def test_get_balance(self):
        self.assertEqual(self.atm.card_balance(), 700)
        self.atm.card.get_account().get_balance.assert_called_with()

    def test_get_cash_success(self):
        remaining = self.atm.get_money(50)
        self.atm.card.get_account().get_balance.assert_called_with()
        self.atm.card.get_account().withdraw.assert_called_with(50)
        self.assertEqual(remaining, 600)
        self.assertEqual(self.atm.card_balance(), 650)
        self.assertEqual(self.atm.money_balance, 450)

    def test_not_enough_money_in_atm(self):
        with self.assertRaises(NotEnoughMoneyInATM):
            self.atm.get_money(600)

    def test_not_enough_money_in_account(self):
        with self.assertRaises(NotEnoughMoneyInAccount):
            self.atm.get_money(850)
Exemple #9
0
def Shopping_car():
    global Shopping_cart
    for i in Shopping_cart.keys():
        print(i, '\t', Shopping_cart[i])
    while True:
        print('-----------------------')
        print('1.全部购买')
        print('2.全部删除')
        print('3.显示购物车物品')
        print('4.充值')
        print('0.退出')
        print('-----------------------')
        choose_s_c = input('请输入你的选择:')
        if choose_s_c == '1':
            sum = 0
            for i in Shopping_cart.keys():
                with open(SPWD, 'r') as f:
                    danjia = int(json.load(f)[i])
                shuliang = int(Shopping_cart[i])
                sum += danjia * shuliang

            print('总共:', sum, " 元")
            with open('./user/%s.json' % USER, 'r') as f:
                money = json.load(f)['money']
                if sum - float(money) > CHAO_E:
                    print('余额不足')
                    continue
            with open('./user/%s.json' % USER, 'w') as f:
                yu_e = float(money) - float(sum)
                json.dump(yu_e, f)
                print('全部购买成功!')
            act = '付款了 %s' % sum
            log(act)
            Shopping_cart = {}
        elif choose_s_c == '2':
            try:
                Shopping_cart = {}
                logs('清空购物车成功!')
                print('清除购物车成功!')
            except:
                print('清除购物车失败!!')
        elif choose_s_c == '3':
            print('商品\t', '数量')
            for i in Shopping_cart.keys():
                print(i, '\t', Shopping_cart[i])
        elif choose_s_c == '4':
            ATM.cz(USER, PASSWD, user_state)
        elif choose_s_c == '0':
            break
        else:
            print('输入有误!')

    return
def Sign():
    app.startSubWindow("SignUp")
    app.addLabel("Welcome create a account")
    app.addLabelEntry("Your User Name")
    app.addLabelEntry("Your Password")
    usr = app.getEntry("Your User Name")
    pwdd = app.getEntry("Your Password")
    app.addButton("CreateAccount", ATM.SignUp(usr, pwdd))
    app.showSubWindow("SignUp", hide=True)
def ReTry():
    user = app.getEntry("User Name")
    session = ATM.Control(user)
    pwd = app.getEntry("Password")
    session.Login(pwd)
    if session.Login(pwd) == 2:
        app.addLabel("Wrong Password")
        ReTry()
    else:
        Manager()
def pay_shoping_bus():
    cost_money = 0
    info = user.loginInfo
    if info[user.userName]['shoping_bus'] == []:
        print('your shopnig bus is null.')
        return False
    for i in info[user.userName]['shoping_bus']:
        cost_money += i['price'] * i['num']
    if ATM.use_money(cost_money):
        info[user.userName]['shoping_bus'] = []
    user.modifyInfo(info)
def Dep(btn):
    if btn == "Deposit":
        amount = app.getEntry("Amount")
        session = ATM.Control(app.getEntry("User Name"))
        session.Login(app.getEntry("Password"))
        session = ATM.Accounts(app.getEntry("User Name"))
        session.Deposit(float(amount))
        app.clearEntry("Amount")
    elif btn == "Withdraw":
        amount = app.getEntry("Amount")
        session = ATM.Control(app.getEntry("User Name"))
        session.Login(app.getEntry("Password"))
        session = ATM.Accounts(app.getEntry("User Name"))
        session.WithDraw(float(amount))
        app.clearEntry("Amount")
        if session.WithDraw(float(amount)) == 4:
            print("Reeeeeee")
            app.addLabel("Not enough money")
            app.clearEntry("Amount")
    else:
        app.stop()
def LoginBtn(button):
    if button == "Cancel":
        app.stop()
    elif button == "Submit":
        user = app.getEntry("User Name")
        session = ATM.Control(user)
        pwd = app.getEntry("Password")
        session.Login(pwd)
        if session.Login(pwd) == 1:
            Manager()
        elif session.Login(pwd) == 2:
            app.addLabel("Wrong Password")
            ReTry()
    else:
        print('WTF')
        Sign()
Exemple #15
0
    def test_bank_2(self):
        test_bank = Bank.Bank()
        test_bank.add_entry(123456789, 1234, "checking", 1000)
        test_bank.add_account(123456789, "savings", 1000)
        test_bank.add_entry(987654321, 7321, "checking", 5000)
        test_atm = ATM.ATM(test_bank, 10000)
        cash_bin_over_action = [("See Balance", 0), ("Withdraw", 30000)]

        # Tests cash bin excess handling on account balance
        self.assertEqual(
            test_atm(987654321, 7321, "checking", cash_bin_over_action),
            "Actions completed")

        exit_action = [("See Balance", 0), ("Leave", 0)]
        self.assertEqual(test_atm(987654321, 7321, "checking", exit_action),
                         "Gracefully departed")
Exemple #16
0
    def test_bank_1(self):
        test_bank = Bank.Bank()
        test_bank.add_entry(123456789, 1234, "checking", 1000)
        test_bank.add_account(123456789, "savings", 1000)
        test_bank.add_entry(987654321, 7321, "checking", 5000)
        test_atm = ATM.ATM(test_bank, 10000)
        action_list = [("See Balance", 0), ("Withdraw", 40),
                       ("Withdraw", 1000), ("Deposit", 100)]

        # These next test should be a correctly executing test case
        self.assertEqual(test_atm(987654321, 7321, "checking", action_list),
                         "Actions completed")

        # Tests whether ATM handles overdraft attempt without crashing
        self.assertEqual(test_atm(123456789, 1234, "checking", action_list),
                         "Actions completed")

        # Test incorrect PIN number
        self.assertEqual(test_atm(987654321, 1234, "checking", action_list),
                         "Invalid Card or Incorrect Pin!")

        # Test incorrect Account number
        self.assertEqual(test_atm(876504321, 1234, "checking", action_list),
                         "Invalid Card or Incorrect Pin!")
Exemple #17
0
 def test_empty_bank(self):
     empty_bank = Bank.Bank()
     empty_atm = ATM.ATM(empty_bank, 0)
     valid, message = empty_atm.swipe(0, 0)
     self.assertEqual(valid, 0)
Exemple #18
0
	def draw(self, visRgn=None):
		# This a HELL of a routine, but it's pretty damn fast...
		import Qd
		if not self._visible:
			return
		Qd.EraseRect(Qd.InsetRect(self._bounds, 1, 1))
		cliprgn = Qd.NewRgn()
		savergn = Qd.NewRgn()
		Qd.RectRgn(cliprgn, self._bounds)
		Qd.GetClip(savergn)
		Qd.SetClip(cliprgn)
		try:
			if self.glyph:
				l, t, r, b = Qd.InsetRect(self._bounds, 1, 1)
				height = b - t
				scale = float(height) / (self.yMax - self.yMin)
				topoffset = t + scale * self.yMax
				width = scale * self.glyph.width
				lsb = scale * self.glyph.lsb
				xMin = scale * self.glyph.xMin
				# XXXX this is not correct when USE_MY_METRICS is set in component!
				leftoffset = l + 0.5 * (r - l - width)
				gleftoffset = leftoffset - xMin + lsb
				if self.showlines:
					Qd.RGBForeColor((0xafff, 0xafff, 0xafff))
					# left sidebearing
					Qd.MoveTo(leftoffset, t)
					Qd.LineTo(leftoffset, b - 1)
					# right sidebearing
					Qd.MoveTo(leftoffset + width, t)
					Qd.LineTo(leftoffset + width, b - 1)
					# baseline
					Qd.MoveTo(l, topoffset)
					Qd.LineTo(r - 1, topoffset)
					
					# origin
					Qd.RGBForeColor((0x5fff, 0, 0))
					Qd.MoveTo(gleftoffset, topoffset - 16)
					Qd.LineTo(gleftoffset, topoffset + 16)
					# reset color
					Qd.RGBForeColor((0, 0, 0))
				
				if self.glyph.iscomposite:
					Qd.RGBForeColor((0x7fff, 0x7fff, 0x7fff))
				
				ATM.startFillATM()
				contours = self.glyph.getcontours((scale, -scale), (gleftoffset, topoffset))
				for contour, flags in contours:
					currentpoint = None
					done_moveto = 0
					i = 0
					nPoints = len(contour)
					while i < nPoints:
						pt = contour[i]
						if flags[i]:
							# onCurve
							currentpoint = lineto(pt, done_moveto)
						else:
							if not currentpoint:
								if not flags[i-1]:
									currentpoint = 0.5 * (contour[i-1] + pt)
								else:
									currentpoint = contour[i-1]
							if not flags[(i+1) % nPoints]:
								endPt = 0.5 * (pt + contour[(i+1) % nPoints])
							else:
								endPt = contour[(i+1) % nPoints]
								i = i + 1
							# offCurve
							currentpoint = qcurveto(currentpoint, 
									pt, endPt, done_moveto)
						done_moveto = 1
						i = i + 1
					ATM.fillClosePathATM()
				ATM.endFillATM()
				# draw point markers
				if self.showpoints:
					for contour, flags in contours:
						Qd.RGBForeColor((0, 0xffff, 0))
						for i in range(len(contour)):
							(x, y) = contour[i]
							onCurve = flags[i] & 0x1
							if onCurve:
								Qd.PaintRect(Qd.InsetRect((x, y, x, y), -2, -2))
							else:
								Qd.PaintOval(Qd.InsetRect((x, y, x, y), -2, -2))
							Qd.RGBForeColor((0xffff, 0, 0))
						Qd.RGBForeColor((0, 0, 0))
			Qd.FrameRect(self._bounds)
		finally:
			Qd.SetClip(savergn)
			Qd.DisposeRgn(cliprgn)
			Qd.DisposeRgn(savergn)
Exemple #19
0
#-*-coding:utf-8-*-
#@Time:20:14
#@Author:Alvin Hu

import os
import sys

DIR_NAME = os.path.dirname(os.path.dirname(__file__))
sys.path.append(DIR_NAME)

import ATM
import Shopping

while True:
    print("Welcome to Shopping Cart demo")
    print("\t1.Go Shopping")
    print("\t2.Manage my ATM")
    choice = input("Choice(q to quit)>>:").strip()
    if choice == "1":
        Shopping.main_Shopping()
    elif choice == "2":
        ATM.main_ATM()
    elif choice == "q":
        print("GoodBye")
        exit(0)
Exemple #20
0
 def setUp(self):
     self.atm = ATM(500)
     account = mocked_account(balance=700)
     card = mocked_card(account=account)
     self.atm.validate_card(card, ANY)
Exemple #21
0
from ATM import *

if __name__ == '__main__':
    atm1 = ATM(1)
    atm2 = ATM(2)
    atm3 = ATM(3)

    atm1.deposit(11, 2500)
    atm2.withdraw(12, 1000)
    atm3.deposit(12, 7000)
    atm3.deposit(13, 1500)
    atm1.withdraw(11, 500)
    atm2.withdraw(13, 1500)
    atm2.deposit(11, 7000)
    atm1.deposit(13, 3500)

    for number in accounts.keys():
        print("the account #{0} contains {1}€".format(number,
                                                      atm1.balance(number)))
Exemple #22
0
 def setUp(self):
     self.atm = ATM(100)
Exemple #23
0
    def draw(self, visRgn=None):
        # This a HELL of a routine, but it's pretty damn fast...
        import Qd
        if not self._visible:
            return
        Qd.EraseRect(Qd.InsetRect(self._bounds, 1, 1))
        cliprgn = Qd.NewRgn()
        savergn = Qd.NewRgn()
        Qd.RectRgn(cliprgn, self._bounds)
        Qd.GetClip(savergn)
        Qd.SetClip(cliprgn)
        try:
            if self.glyph:
                l, t, r, b = Qd.InsetRect(self._bounds, 1, 1)
                height = b - t
                scale = float(height) / (self.yMax - self.yMin)
                topoffset = t + scale * self.yMax
                width = scale * self.glyph.width
                lsb = scale * self.glyph.lsb
                xMin = scale * self.glyph.xMin
                # XXXX this is not correct when USE_MY_METRICS is set in component!
                leftoffset = l + 0.5 * (r - l - width)
                gleftoffset = leftoffset - xMin + lsb
                if self.showlines:
                    Qd.RGBForeColor((0xafff, 0xafff, 0xafff))
                    # left sidebearing
                    Qd.MoveTo(leftoffset, t)
                    Qd.LineTo(leftoffset, b - 1)
                    # right sidebearing
                    Qd.MoveTo(leftoffset + width, t)
                    Qd.LineTo(leftoffset + width, b - 1)
                    # baseline
                    Qd.MoveTo(l, topoffset)
                    Qd.LineTo(r - 1, topoffset)

                    # origin
                    Qd.RGBForeColor((0x5fff, 0, 0))
                    Qd.MoveTo(gleftoffset, topoffset - 16)
                    Qd.LineTo(gleftoffset, topoffset + 16)
                    # reset color
                    Qd.RGBForeColor((0, 0, 0))

                if self.glyph.iscomposite:
                    Qd.RGBForeColor((0x7fff, 0x7fff, 0x7fff))

                ATM.startFillATM()
                contours = self.glyph.getcontours((scale, -scale),
                                                  (gleftoffset, topoffset))
                for contour, flags in contours:
                    currentpoint = None
                    done_moveto = 0
                    i = 0
                    nPoints = len(contour)
                    while i < nPoints:
                        pt = contour[i]
                        if flags[i]:
                            # onCurve
                            currentpoint = lineto(pt, done_moveto)
                        else:
                            if not currentpoint:
                                if not flags[i - 1]:
                                    currentpoint = 0.5 * (contour[i - 1] + pt)
                                else:
                                    currentpoint = contour[i - 1]
                            if not flags[(i + 1) % nPoints]:
                                endPt = 0.5 * (pt + contour[(i + 1) % nPoints])
                            else:
                                endPt = contour[(i + 1) % nPoints]
                                i = i + 1
                            # offCurve
                            currentpoint = qcurveto(currentpoint, pt, endPt,
                                                    done_moveto)
                        done_moveto = 1
                        i = i + 1
                    ATM.fillClosePathATM()
                ATM.endFillATM()
                # draw point markers
                if self.showpoints:
                    for contour, flags in contours:
                        Qd.RGBForeColor((0, 0xffff, 0))
                        for i in range(len(contour)):
                            (x, y) = contour[i]
                            onCurve = flags[i] & 0x1
                            if onCurve:
                                Qd.PaintRect(Qd.InsetRect((x, y, x, y), -2,
                                                          -2))
                            else:
                                Qd.PaintOval(Qd.InsetRect((x, y, x, y), -2,
                                                          -2))
                            Qd.RGBForeColor((0xffff, 0, 0))
                        Qd.RGBForeColor((0, 0, 0))
            Qd.FrameRect(self._bounds)
        finally:
            Qd.SetClip(savergn)
            Qd.DisposeRgn(cliprgn)
            Qd.DisposeRgn(savergn)
Exemple #24
0
def main():

    # Test Cases
    '''
    dylan = Customer("Dylan", 19, 724, "MALE", 123, 10000, 2000)
    print(dylan.accessCustomerSupport())
    print(dylan)
    money = dylan.withdrawal(123, 200)
    print(money)
    money2 = dylan.withdrawal(123, 2000)
    print(money2)
    money3 = dylan.withdrawal(123456789, 200)
    print(money3)
    dylan.deposit(5000000)
    dylan.deposit(5000000)
    print(Customer.amountOfCustomer())
    del(dylan)
    print(Customer.amountOfCustomer())
    '''
    '''
    dylan = Customer("Dylan", 19, 724, "MALE", 123, 10000, 2000)
    dylan2 = Customer("Dylan2", 19, 724, "MALE", 123, 90, 2000)
    print(dylan)
    print(dylan2)
    dylan.transferFunds(10, dylan2)
    print(dylan)
    print(dylan2)
    '''
    '''
    eric = Employee('Eric', 19, 7245491059, 'Male', 14, 'ewb5319', 'hello')
    #print(eric.paygrade())
    #print(eric.accessCustomerSupport())
    #print(eric.getEmployeeNumber())
    #eric.changePassword()
    print(eric)
    print(Employee.employeeCount())
    del(eric)
    print(Employee.employeeCount())

    eric = Employee('Eric', 19, 7245491059, 'Male', 14, 'ewb5319', 'hello')
    print(eric)
    dude = Manager('dude', 19, 12345678, 'Male', 14, 'asdf', 'asdf')
    dude.givePromotion(eric, 1500)
    print(eric)
    '''
    '''
    dude = Manager('dude', 19, 12345678, 'Male', 14, 'asdf', 'asdf')
    dylan2 = Customer("Dylan", 19, 724, "MALE", 123, 10000, 2000)
    eric = Teller('Eric', 19, 7245491059, 'Male', 14, 1234, 1234, 'ewb5319', 'hello', dude)

    print(eric)
    print(dylan2)

    print(dude.seeCustomerDetails(dylan2))
    print(eric.seeCustomerDetails(dylan2))
    '''
    '''
    dylan2 = Customer("Dylan", 19, 724, "MALE", 123, 10000, 2000)
    print(dylan2)
    ATM(dylan2)
    print(dylan2)
    '''
    '''
    eric3 = Child('Eric', 14, 724, 'Male', 1234, 1000.50, 1000.50)
    print(eric3)
    print(Customer.amountOfCustomer())
    print(Child.amountOfChildren())
    eric3.deposit(500)
    eric3.checkChecBalance()
    eric3.checkSavBalance()
    print(eric3)
    '''

    eric = Child('Eric', 14, 724, 'Male', 1, 1000, 1000)
    ATM(eric)
    dude = Manager('dude', 19, 12345678, 'Male', 14, 'asdf', 'asdf')
    print(dude.seeCustomerDetails(eric))
    print(Customer.amountOfCustomer())
    del eric
    print(Customer.amountOfCustomer())
    '''
    eric2 = Adult('Eric2', 19, 724, 'Male', 2, 1000, 1000)
    '''
    '''
    eric.checkChecBalance()
    eric2.checkChecBalance()
    eric.deposit(20)
    eric2.deposit(20)
    eric.checkChecBalance()
    eric2.checkChecBalance()

    eric2.childDeposit(20, eric)
    eric.checkChecBalance()

    eric2.withdrawal(2,20)
    eric2.checkChecBalance()
    '''
    '''
Exemple #25
0
def displayMenu():
    print("Menu:\n"
          "1. Balance Display\n"
          "2. Deposit Money\n"
          "3. Withdraw Money\n"
          "4. Interest\n"
          "5. Loans\n"
          "6. Donate Money\n"
          "7. Stocks\n"
          "8. ATM\n"
          "9. Insurance\n"
          "10. Recent Transactions\n"
          "11. Shop\n"
          "0. Exit")
    choice = str(input("Type your choice number. \n"))

    if choice == "1":
        print("Your balance is: ", Balance.balance)
        pressAnyKey()
        displayMenu()

    elif choice == "2":
        Transactions.depositMoney()
        pressAnyKey()
        displayMenu()

    elif choice == "3":
        Transactions.withdrawMoney()
        pressAnyKey()
        displayMenu()

    elif choice == "4":
        Interest.interestCalculation()
        Interest.interestMoney()
        pressAnyKey()
        displayMenu()

    elif choice == "5":
        Loan.performLoan()
        pressAnyKey()
        displayMenu()

    elif choice == "6":
        Transactions.donateMoney()
        pressAnyKey()
        displayMenu()

    elif choice == "7":
        StockMarket.options()
        pressAnyKey()
        displayMenu()

    elif choice == "8":
        ATM.atmSecurity()
        pressAnyKey()
        displayMenu()

    elif choice == "9":
        Insurance.insuranceType()
        pressAnyKey()
        displayMenu()

    elif choice == "10":
        RecentTransactions.display()
        pressAnyKey()
        displayMenu()

    elif choice == "11":
        Shop.startShop()
        pressAnyKey()
        displayMenu()

    elif choice == "0":
        print("Goodbye...")
        exit()

    else:
        print("Please enter a valid thing to do.")
        displayMenu()
Exemple #26
0
    act = input('请输入你的操作:')
    if act == '2':
        Regist()
    else:
        logs()

while user_state == True:
    print('------Welcome < %s > to Main Menu----- ' % USER)
    print('1.商场')
    print('2.注册')
    print('3.购物车')
    print('4.个人中心')
    print('5.ATM')
    print('0.退出')
    choose = int(input('你的操作:'))
    if choose == 1:
        Shop()
    elif choose == 2:
        Regist()
    elif choose == 3:
        Shopping_car()
    elif choose == 4:
        Person()
    elif choose == 5:
        if ATM.run(USER, PASSWD, user_state) == True:
            exit()
    elif choose == 0:
        exit()
    else:
        print("输入错误")
Exemple #27
0
from ATM import *

# card initialization
file = open("account.txt", "r")

bank = file.readline()

username = file.readline()

pin = int(file.readline())

balance = float(file.readline())

file.close()

x = ATM(bank, username, pin, balance)


# function to call the methods for basic operations on ATM
def transactions():
    time.sleep(1.0)
    print("1.Make a deposit.\n")
    time.sleep(1.0)
    print("2.Make a withdraw.\n")
    time.sleep(1.0)
    print("3.Check the current balance.\n")

    choice = int(input())
    clear_screen()
    if choice == 1:
        x.deposit()
Exemple #28
0
# Author  : Bruce li
# Date    : 2019-11-03
# Describe: 模拟实现一个ATM + 购物商城程序
# Trouble : None

#     ·额度 15000或自定义
#     ·实现购物商城,买东西加入购物车,调用信用卡接口结账
#     ·可以提现,手续费5%
#     ·支持多账户登录
#     ·支持账户间转账
#     ·提供还款接口
#     ·ATM记录操作日志
#     ·记录每月日常消费流水
#     ·每月22号出账单,每月10号为还款日,过期未还,按欠款总额 万分之5 每日计息
#     ·提供管理接口,包括添加账户、用户额度,冻结账户等。。。
#     ·用户认证用装饰器

import Shopping, ATM
while True:
    print('=' * 60)
    print('1、ATM\n2、购物商城')
    print('=' * 60)
    choice = input('人生总会遇到很多个十字路口, 因而会有许多选择。虽然似乎毫无逻辑, 但这也需要你的选择==>:')
    if choice == '1':
        ATM.ATM_main()
        Shopping.main()
    elif choice == '2':
        Shopping.main()
    else:
        continue
Exemple #29
0
import ATM
def withdraw(ATM,request):
	print("Welcome to The Bank " ,self.bank_name)
	print("Your balance is : " ,self.balance)

	#Current_Balance = 0
	#pvals=[100,50,10,5,2,1]
	#if request <= balance:
		#for index in pvals
atm1=ATM(500,Cairo_Bank)




#def withdraw(Balance,request):
	#Current_Balance = 0
	#pvals=[100,50,10,5,2,1]
	#if request <= Balance:
		#for index in pvals:
			#while request - index >=0:
				#print("give " + str(index))
				#request -= index
				#Current_Balance = Current_Balance+index
		#print ("Current_Balance is:  ") , Balance - Current_Balance
	#else:
		#print "Can't give you this money !!"
		
#Balance = 500
#print withdraw(Balance,278)
#print withdraw(Balance,600)
#print withdraw(Balance,5)