Question: Q 4 . Define classes and use objects in a test program ( 6 marks ) Consider a banking system where each account has a

Q4. Define classes and use objects in a test program (6 marks)
Consider a banking system where each account has a balance and an account number. Define a class called
BankAccount that represents a bank account with the following UML:
Attributes descriptions:
account_number: client bank account number.
balance: the current balance of the account.
last_transaction_type: the type of the last transaction ("Deposit" or "Withdraw"). It is "- by default.
last_transaction_amount: the amount of the last transaction.
accounts_count: static variable counts the number of accounts in the bank. The default value is 0.
total_balances: static variable defines the current balances of all accounts. The default value is
10,000,000.
3- In the Main Class [2 pt];
a. Create 2 objects of BankAccount Class: 3000 AFD for the first, 10000 AFD for the second. Sugest
your own values for account_number.
b. Withdraw 6000 AED from the first account, and 5000 AED from the second account.
c. Print the account number, the balance and the last transaction of the first account.
d. Print the number of accounts in the bank and the total balances.
 Q4. Define classes and use objects in a test program (6

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!