package dev.banking.model; /** * Represents a withdrawal operation. */ public final class WithdrawTransaction extends Transaction { private final int accountId; public WithdrawTransaction( int accountId, int amount ) { super(amount); if (accountId < 0) { throw new IllegalArgumentException( "Invalid account id." ); } this.accountId = accountId; } public int getAccountId() { return accountId; } @Override public String toString() { return "WithdrawTransaction{" + "accountId=" + accountId + ", amount=" + getAmount() + '}'; } }