Skip to content

Pedrohss2/SimuBank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SimuBank

SimuBank is a simple project made in Java to practice issuing exceptions. The project consists of a simulation of account creation with withdrawal and deposit methods. methods with value checks and throwing exceptions.

Methods

     public void deposit(Double amount) {
        this.withdrawLimit += amount;
    }

    public void withdraw(Double amount) throws ErrorsAccount {
        if(amount > withdrawLimit) {
            throw new ErrorsAccount("Withdraw error: The amount exceeds withdraw limit!");
        }
        if(withdrawLimit > balance) {
            throw new ErrorsAccount("Withdraw error: not enough balance! ");
        }
        this.balance -= amount;
    }

    public class ErrorsAccount extends Exception {
        public ErrorsAccount(String message) {
            super(message);
        }
    }

Functionalities

  • Withdrawal and deposit
  • Account creation
  • Withdrawal limit amount.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages