Commit e30d2705 authored by sam.pople's avatar sam.pople

Finished

parent e96d9781
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -3,17 +3,15 @@ public class App { ...@@ -3,17 +3,15 @@ public class App {
BankAccount example = new BankAccount(97812345, "Sam", 34343); BankAccount test1 = new BankAccount(78345, "Sam", 34343);
test1.withdrawal(100000);
example.withdrawal(100000); test1.Overdraftvalue(100000000);
test1.withdrawal(500000);
example.Overdraftvalue(100000000); test1.display();
example.withdrawal(500000);
example.display(); SavingsAccount test2 = new SavingsAccount(78345, "Samuel", 34343);
test2.Overdraftvalue(9000000);
SavingsAccount example2 = new SavingsAccount(97812345, "Sam", 34343); test2.withdrawal(4500000);
example2.Overdraftvalue(100000000);
example2.withdrawal(1000000);
} }
......
No preview for this file type
...@@ -10,8 +10,9 @@ public class BankAccount { ...@@ -10,8 +10,9 @@ public class BankAccount {
private int accountNumber; private int accountNumber;
private String name; private String name;
private int balance; private int balance;
private double fees = 0.95;
protected int overdraft = 0; protected int overdraft = 0;
private double fees = 0.95;
public int getAccountNumber() { public int getAccountNumber() {
return accountNumber; return accountNumber;
...@@ -87,8 +88,8 @@ public class BankAccount { ...@@ -87,8 +88,8 @@ public class BankAccount {
} }
public void display() throws Exception { public void display() throws Exception {
System.out.println("Bank details: "); System.out.println("Bank details: ");
System.out.println("\nAccount no.: " + this.getAccountNumber() + "\nAccount holder: "+this.getName()); System.out.println("\nAccount no.: " + this.getAccountNumber() + "\nAccount holder: " + this.getName());
String balance = this.formatAmount(this.getBalance()); String balancevalue = this.formatAmount(this.getBalance());
System.out.println("Balance: " + balance); System.out.println("Balance: " + balancevalue);
} }
} }
No preview for this file type
...@@ -2,15 +2,11 @@ public class SavingsAccount extends BankAccount { ...@@ -2,15 +2,11 @@ public class SavingsAccount extends BankAccount {
public SavingsAccount(int accountNumber, String name, int balance) { public SavingsAccount(int accountNumber, String name, int balance) {
super(accountNumber, name, balance); super(accountNumber, name, balance);
this.Feesvalue(1.00); this.Feesvalue(1.00);
} }
public void accrueInterest() throws Exception {
this.Balancevalue((int) Math.round(this.getBalance() * 1.05));
}
public int getOverdraft(int amount) { public int getOverdraft(int amount) {
return 0; return 0;
} }
public void accrueInterest() throws Exception {
this.Balancevalue((int) Math.round(this.getBalance() * 1.05));
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment