Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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:
Astributes 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
In BankAccount Class, Write the code for the method 'withdraw' pt:
a withdraw amount : double : withdraws the specified amount from the account.
b If sufficient funds are available: the method updates the balance by subtracting the amount, then
sets lasttransactiontype to "Withdraw", and sets lasttransactionamount to the value of the
parameter 'amount'.
c Otherwise, If the amount is not avallable, a warning message should be displayed indicating that
"the amount is not available".
d This method updates the static variable "totalbalances' by subtracting the amount, if sufficient
funds are available.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started