Guest User

Untitled

a guest
Jun 18th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1.  
  2. /**
  3. * Write a description of class BankAccount here.
  4. *
  5. * @author (your name)
  6. * @version (a version number or a date)
  7. */
  8. public class BankAccount
  9. {
  10. // Show the balance
  11. public int balance;
  12. private String negBalance;
  13.  
  14.  
  15. /**
  16. * Creates the balance/bank account
  17. */
  18. public BankAccount()
  19. {
  20. balance = balance;
  21. }
  22.  
  23. /**
  24. Welcome Customer.
  25. Your current balance will be shown in Kroner.
  26. **/
  27.  
  28. public int getBalance()
  29. {
  30. return balance;
  31. }
  32.  
  33. public int depoMoney(int amount)
  34. {
  35. balance = balance + amount;
  36. return balance;
  37.  
  38. }
  39.  
  40. public int withMoney(int amount)
  41. {
  42. balance = balance - amount;
  43. }
  44.  
  45. private String negBalance()
  46. {
  47. if(balance >= 0)
  48. {
  49. return ("Sorry, you current balance is negative. Can't withdraw");
  50. }
  51. else
  52. {
  53. return balance;
  54. }
  55.  
  56. }
  57. }
Add Comment
Please, Sign In to add comment