Question: Q 4 . Define classes and use objects in a test program ( 6 marks ) Consider a banking system where each account has a
Q Define classes and use objects in a test program 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:
accountnumber: client bank account number.
balance: the current balance of the account.
lasttransactiontype: the type of the last transaction Deposit or "Withdraw" It is by default.
lasttransactionamount: the amount of the last transaction.
accountscount: static variable counts the number of accounts in the bank. The default value is
totalbalances: static variable defines the current balances of all accounts. The default value is
Assume your instructor has coded most of methods and attributes, but your instructor needs your help
in the following parts:
In BankAccount Class, Write the code for the constructor pt:
a BankAccount accountnumber : String, balance : double : constructor defines the account
number and the starting balance.
b This method updates all the static member variables. The accountscount should be incremented,
and the balance should be added to the totalbalances.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
