volume_mute
Object Classes for a Bank Account
publish date: 1969/12/31 00:00:00 UTC
volume_mute
Using the UML graphical notation for object classes, design a BankAccount object class. Which of the following sets of attributes and operations is most appropriate for a BankAccount class?
Correct Answer
Attributes: accountNumber, holderName, balance, accountType; Operations: deposit(amount), withdraw(amount), getBalance(), transfer(amount, targetAccount), getStatement()
Explanation
A BankAccount object class should encapsulate the account's own data (accountNumber, holderName, balance, accountType) and provide operations that act on that data (deposit, withdraw, getBalance, transfer, getStatement). The other options describe authentication objects, transaction records, or branch management objects - not bank accounts. The key OO principle is that attributes represent state and operations represent behaviours that change or query that state.
Reference
Software Engineering, Ian Sommerville, 10th edition
