Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Write a description of class BankAccount here.
- *
- * @author (your name)
- * @version (a version number or a date)
- */
- public class BankAccount
- {
- // Show the balance
- public int balance;
- private String negBalance;
- /**
- * Creates the balance/bank account
- */
- public BankAccount()
- {
- balance = balance;
- }
- /**
- Welcome Customer.
- Your current balance will be shown in Kroner.
- **/
- public int getBalance()
- {
- return balance;
- }
- public int depoMoney(int amount)
- {
- balance = balance + amount;
- return balance;
- }
- public int withMoney(int amount)
- {
- balance = balance - amount;
- }
- private String negBalance()
- {
- if(balance >= 0)
- {
- return ("Sorry, you current balance is negative. Can't withdraw");
- }
- else
- {
- return balance;
- }
- }
- }
Add Comment
Please, Sign In to add comment