Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class BankAccount {
- public String accountNumber;
- public String owner;
- public double balance;
- public BankAccount(String accountNumber, String owner, double balance) {
- this.accountNumber = accountNumber;
- this.owner = owner;
- this.balance = balance;
- }
- public void displayInfo(){
- System.out.println("The accountNumber of the bank account is: " + accountNumber);
- System.out.println("The owner of the bank account is: " + owner);
- System.out.println("The balance of the bank account is: " + balance);
- }
- public void deposit(double amount) {
- balance += amount;
- System.out.println("The new balance after the deposit is: " + balance);
- }
- public void withdraw(double amount) {
- if (balance >= amount) {
- balance -= amount;
- System.out.println("The new balance after the withdraw is: " + balance);
- } else {
- System.out.println("Not enough balance!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement