Need help with this asap.

2016-01-12 Thread ifeanyioprah--- via Python-list

Create a class called BankAccount
Create a constructor that takes in an integer and assigns this to a `balance` 
property.
Create a method called `deposit` that takes in cash deposit amount and updates 
the balance accordingly.
Create a method called `withdraw` that takes in cash withdrawal amount and 
updates the balance accordingly. if amount is greater than balance return 
`"invalid transaction"`
Create a subclass MinimumBalanceAccount of the BankAccount class.
This was my solution and I still got error. What should I do.
class BankAccount: 
    def __init__(self, initial_amount): 
        self.balance = initial_amount 
    def deposit(self, amount): 
        self.balance += amount 
    def withdraw(self, amount): 
        if self.balance>= amount: 
            self.balance  -=  amount 
        else: 
          print('invalid transaction') 
a1 = BankAccount (90) 
a1.deposit(90) 
a1.withdraw(40) 
a1.withdraw(1000) 
class MinimumBalanceAccount(BankAccount): 
    def __init__(self): 
        BankAccount.__init__(self) 

Please help me.
-- 
https://mail.python.org/mailman/listinfo/python-list


Need solution with this problem

2016-01-13 Thread ifeanyioprah--- via Python-list

Create a class called BankAccount­
Create a constructor that takes in an in­teger and assigns this to a `balance` 
pr­operty.
Create a method called `deposit` that ta­kes in cash deposit amount and updates 
t­he balance accordingly.
Create a method called `withdraw` that t­akes in cash withdrawal amount and 
updat­es the balance accordingly. if amount is­ greater than balance return 
`"invalid t­ransaction"`
Create a subclass MinimumBalanceAccount ­of the BankAccount class
import unittest class AccountBalanceTest­Cases(unittest.TestCase): def 
setUp(self­): self.my_account = BankAccount(90)
def test_balance(self): self.assertEqual­(self.my_account.balance, 90, 
msg='Accou­nt Balance Invalid')
def test_deposit(self): self.my_account.­deposit(90) 
self.assertEqual(self.my_acc­ount.balance, 180, msg='Deposit method 
i­naccurate')
def test_withdraw(self): self.my_account­.withdraw(40) 
self.assertEqual(self.my_a­ccount.balance, 50, msg='Withdraw method­ 
inaccurate')
def test_invalid_operation(self): 
self.a­ssertEqual(self.my_account.withdraw(1000­), "invalid transaction", 
msg='Invalid t­ransaction')
def test_sub_class(self): self.assertTru­e(issubclass(MinimumBalanceAccount, 
Bank­Account), msg='No true subclass of BankA­ccount')
Thank you.­
Pls need assistance. My email : ifeanyiop...@yahoo.com.
-- 
https://mail.python.org/mailman/listinfo/python-list