Merge pull request #2 from Klagarge/comments-BankAccount

finish comments on BankAccount
This commit is contained in:
Rémi Heredero 2022-05-10 17:15:47 +02:00 committed by GitHub
commit 3969ca3ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

Binary file not shown.

View File

@ -2,6 +2,7 @@ package bank;
/** /**
* Create a bank account with a balance and a owner * Create a bank account with a balance and a owner
* General abstract class for used in specific other bank account
*/ */
public abstract class BankAccount { public abstract class BankAccount {
protected double balance; protected double balance;
@ -9,7 +10,7 @@ public abstract class BankAccount {
/** /**
* Get balance of the account * Get balance of the account
* @return the balance of the account * @return The balance of the account
*/ */
public double getBalance() { public double getBalance() {
return balance; return balance;
@ -18,7 +19,7 @@ public abstract class BankAccount {
/** /**
* Deposit an amount on your account * Deposit an amount on your account
* Check the amount for accept only positive amount. * Check the amount for accept only positive amount.
* @param amount * @param amount The amount you want to deposit (have to be positive).
*/ */
public void deposit(double amount){ public void deposit(double amount){
if(amount<0){ if(amount<0){
@ -31,7 +32,7 @@ public abstract class BankAccount {
/** /**
* Withdraw an amount on your account * Withdraw an amount on your account
* Check the amount for be sure you have this money * Check the amount for be sure you have this money
* @param amount The amount you want to withdraw * @param amount The amount you want to withdraw (have to be less or equal to the money you have)
* @return true : if the withdraw has been done * @return true : if the withdraw has been done
*/ */
public boolean withdraw(double amount){ public boolean withdraw(double amount){
@ -43,9 +44,10 @@ public abstract class BankAccount {
} }
/** /**
* Explain the problem, if something is wrong * Explain the problem, if something is wrong. And print it on terminal.
* @param text *
* @return the explanation of the problem * @param text The description of your specific error
* @return return always false. Can be used for check if have a problem
*/ */
protected boolean error(String text){ protected boolean error(String text){
System.out.println("Problem : " + text); System.out.println("Problem : " + text);