Python Class and Objects Create a class named "Account" and “Bank” The class “Account” should have a parameter of id - integer type name - string type balance - float type # (Optional) You may add...



Python Class and Objects





  1. Create a class

    named

    "Account"

    and “Bank”




  2. The class

    “Account”

    should have a parameter of


id   - integer type


name - string type


balance - float type


# (Optional) You may add more parameters for your convenience






3
.

Create a method for

“Account” class

:


checkBalance(self)    -  this will show the Account's remaining balance or money


withdraw(self, amount)   - this will withdraw an amount from the Account


deposit(self, amount) - this will deposit an amount from the Account


# (Optional) You may add more methods like sendMoney() etc.






4. Create a method for “Bank” class:


addAccount(self, account) – used to register an account to the bank


# (Optional) You may add more methods for your convenience






4. Create 3 Account objects with the following attributes in the main method


account1 - id=(any number), name=(Any Name You Want), balance=7000 (strictly use this value)


account2 - id=(any number), name=(Any Name You Want), balance= (any amount)


account3 - id=12, name= Jose Rizal , balance= 25000        !(use these values for account3)


# (Optional) You may add more objects if you want.







5
.

In the main method. Write a program that will act as an ATM.


The ATM will prompt for account ID


A menu for check balance, deposit, withdraw and exit shall display







 6. Test your program with the following scenario:


Output 1:


Use Account 1


Check Balance


Withdraw 2000


Exit (End Transaction) program will prompt another user id



Output 2:


Use Account 2


Deposit an amount of 500


Exit (End Transaction) program will prompt another user id


Use Account 3


Check Balance


Exit (End Transaction) program will prompt another user id

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here