Answered step by step
Verified Expert Solution
Link Copied!

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:
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.
In BankAccount Class, Write the code for the method 'withdraw' [2 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 last_transaction_type to "Withdraw", and sets last_transaction_amount 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 "total_balances' by subtracting the amount, if sufficient
funds are available.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions