Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.52 KB | None | 0 0
  1. package bank;
  2.  
  3. class Main {
  4. public static void main (String[] args) {
  5. Account account = new Account(99, "A2B32");
  6. }
  7. }
  8.  
  9. class Bank {
  10. private double interestRate = 8.5;
  11. private double transactionFees = 10;
  12. private Customer [] customer;
  13.  
  14. public void calculateInterest() {
  15.  
  16. }
  17. public void getInterestRate() {
  18.  
  19. }
  20. public double getTransactionFees() {
  21. return transactionFees;
  22. }
  23. }
  24.  
  25.  
  26. class Account {
  27. private double balance = 100;
  28. private String accountNr;
  29. private boolean firstTime = true;
  30. public Account(String acc) {
  31. accountNr = acc;
  32. }
  33. public Account(double bal, String acc) {
  34. if (balance >= 100) {
  35. balance = bal;
  36. }
  37. else {
  38. balance = 100;
  39. }
  40. accountNr = acc;
  41. }
  42.  
  43. public void deposit(double howMuch) {
  44. if (howMuch > 0) {
  45. balance = balance + howMuch;
  46. System.out.println(howMuch + "was successfully deposited to your account.");
  47. }
  48. else{
  49. System.err.println("Please ensure that the amount of the deposit is not negative.");
  50. }
  51. }
  52. public void withdraw(double howMuch) {
  53. if (howMuch > 0) {
  54. if (firstTime == true) {
  55. double tempBalance = balance;
  56. tempBalance = tempBalance - howMuch;
  57. if (tempBalance>=100) {
  58. balance = balance - howMuch;
  59. }
  60. else {
  61. System.err.println("Insufficent balance to remove " + howMuch);
  62. }
  63. firstTime = false;
  64. }
  65. else {
  66. Bank bank = new Bank();
  67. double tempBalance = balance;
  68. tempBalance = tempBalance - howMuch - bank.getTransactionFees();
  69. if (tempBalance>=100) {
  70. balance = balance - howMuch;
  71. }
  72. else {
  73. System.err.println("Insufficent balance to remove " + howMuch);
  74. }
  75. }
  76. }
  77. else{
  78. System.err.println("Please ensure that the amount of the deposit is not negative.");
  79. }
  80. }
  81. public void getBalance() {
  82.  
  83. }
  84. }
  85.  
  86. class Customer {
  87. private String name;
  88. private Account account;
  89.  
  90. public void display() {
  91.  
  92. }
  93. public void getName() {
  94.  
  95. }
  96. public void getAccount() {
  97.  
  98. }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement