Question: Make sure to put the main section of your code in the following if block: # Type code for classes here if __name__ == __main__:
Make sure to put the main section of your code in the following if block:
# Type code for classes here if __name__ == "__main__": # Type main section of code here
(1) Build the Account class with the following specifications:
Attributes
name (str)
account_number (int)
balance (float)
Create a constructor that has 3 parameters (in addition to self) that will be passed in from the user. (no default values)
Define a __str__() method to print an Account like the following
Account Name: Trish Duce Account Number: 90453889 Account Balance: $100.00
Define a deposit() method that has 1 parameter (in addition to self) that will be passed in from the user. (no default values) The method deposits the specified amount in the account.
Define a withdraw() method that has 2 parameters (in addition to self) that will be passed in from the user. (no default values) The method withdraws the specified amount (1st parameter) and fee (2nd parameter) from the account.
(2) In the main section of your code, create 3 accounts.
Trish Duce 90453889 100
Donald Duck 83504837 100
Joe Smith 74773321 100
(3) Print the 3 accounts using print(acct1)
(4) Deposit 25.85, 75.50 and 50 into accounts 1, 2 and 3.
(5) Print the 3 accounts.
(6) Withdraw 25.85 (2.50 fee), 75.50 (1.50 fee), 50.00 (2.00 fee).
(7) Print the 3 accounts.
Output should look like the following:
Account Name: Trish Duce
Account Number: 90453889
Account Balance: $100.00
Account Name: Donald Duck
Account Number: 83504837
Account Balance: $100.00
Account Name: Joe Smith
Account Number: 74773321
Account Balance: $100.00
Account Name: Trish Duce
Account Number: 90453889
Account Balance: $125.85
Account Name: Donald Duck
Account Number: 83504837
Account Balance: $175.50
Account Name: Joe Smith
Account Number: 74773321
Account Balance: $150.00
Account Name: Trish Duce
Account Number: 90453889
Account Balance: $97.50
Account Name: Donald Duck
Account Number: 83504837
Account Balance: $98.50
Account Name: Joe Smith
Account Number: 74773321
Account Balance: $98.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
