Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . Inside accounts.py , create a class named Account with the methods below. a . def _ _ init _ _ ( self ,

1. Inside accounts.py, create a class named Account with the methods below.
a. def __init__(self, name, balance=0):
i. This should be used to set the default values for each account object.
ii. It should contain 2 private variables (account_name, account_balance), that should hold the account name and a balance respectively. Example:
1. account_one = Account(John) is an account object whose account_name = John and account_balance =0.
2. account_two = Account(Tom,30) is an account object whose account_name = Tom and account_balance =30.
3. account_three = Account(Tim,-300) is an account object whose account_name = Tim and account_balance =0.
iii. After setting the account_balance, call the set_balance method to check that the account balance is a valid value.
b. def deposit(self, amount):
i. This should increase the account balance by the specified amount.
ii. If the amount is a negative number or 0, nothing should happen to the account balance (since you cannot deposit a negative amount of money or $0).
iii. Return the Boolean value True if the deposit transaction is successful and False if the transaction is unsuccessful (didnt change account balance).

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design And Implementation

Authors: Shouhong Wang, Hai Wang

1st Edition

1612330150, 978-1612330150

More Books

Students also viewed these Databases questions