Description
Objective:
To work with classes.
Assignment:
Define a class named ‘Account’ with 5 attributes and initialize them as below
Key value
Name <userInput> Savings 100 checking 20
Card 10
Limit 50
data type
(string) (float) (float) (float) (int)
Tip
1)
2)
Create a menu(), which will display the options as shown below:
Option 1: Check Balance Option 2: Exit
Option 1(Check Balance), should call a function check_balance().
The function, check_balance() should display the account owner’s name, his Account Balance and Available Balance in exact format and alignment as below.
Account owner’s name: <Account.name>
3)
Data in the Account balance column is hardcoded; data in the available balance column should be computed dynamically. Rules to compute available balance of account:
Savings Checking Card
$ $
$
110.00 20.00 40.00
Account Balance $ 100.00 $ 20.00 $ 10.00
Available Balance
Note: The alignment must be the same
- a) Â $10 minimum amount must be maintained in the savings account. Therefore, the available balance is the account balance plus minimum amount.
- b) Â Checking account can have any amount larger than or equal to 0.
- c) Â Card available balance cannot exceed its limit (50$), so the available balance
is thedifference between the limit and current card balance.
- d)  If requirements aren’t met, ‘Available account’ should be illustrated as 0, for
all options
You can use string formatting in conjunction with tab for output alignment but using only tab will not be a good choice.
CSCI 161
Sample output:
Instructions:
- Preferred programming environment:
: Linux (Mint)
: Python 3 (not Python 2):geditoreditorofyourchoice
- The program is saved as a file with .py extension.
- The program should include a comment block at the top with your name, course number and course section, assignment number