package com.study.demo2; public class Account { private String accountId; private String owner; private double balance; public Account(String accountId, String owner, double balance) { this.accountId = accountId; this.owner = owner; this.balance = balance; } public void deposit(double amount) { if (amount > 0) { balance += amount; } } public void withdraw(double amount) { if (amount > 0 && amount <= balance) { balance -= amount; } } public void transfer(Account target, double amount) { if (amount > 0 && amount <= balance) { this.balance -= amount; target.balance += amount; } } public double getBalance() { return balance; } }