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

new final submission

parent 538f5eea
No preview for this file type
No preview for this file type
......@@ -2,22 +2,22 @@ public class BankAccount {
// Transactions are in pence
public BankAccount(int accountnumber, String name, int balance) {
public BankAccount(int accountNumber, String name, int balance) {
this.Accountnumbervalue(accountnumber);
this.Accountnumbervalue(accountNumber);
this.Namevalue(name);
this.Balancevalue(balance);
}
private int accountnumber;
private int accountNumber;
private String name;
private int balance;
private double fees = 0.95;
protected int overdraft = 0;
public int getAccountNumber() {
return accountnumber;
return accountNumber;
}
public String getName() {
return name;
......@@ -32,8 +32,8 @@ public class BankAccount {
return overdraft;
}
public void Accountnumbervalue(int accountnumber) {
this.accountnumber = accountnumber;
public void Accountnumbervalue(int accountNumber) {
this.accountNumber = accountNumber;
}
public void Namevalue(String name) {
this.name = name;
......@@ -86,7 +86,6 @@ public class BankAccount {
if (this.getBalance() + this.getOverdraft() < amount) {
System.out.println("Not enough funds for a withdrawal \n");
return false;
} else {
this.Balancevalue(this.getBalance() - amount);
System.out.println("Withdrawal successful " + this.formatAmount(amount) + "\n");
......@@ -95,18 +94,12 @@ public class BankAccount {
}
public void bankFees() throws Exception {
this.Balancevalue(((int) Math.round(this.getBalance()*this.getFees())));
}
public void display() throws Exception {
System.out.println("Bank details: \n");
System.out.println("Account no.: " + this.getAccountNumber() + "\nAccount holder: "+this.getName());
String balance = this.formatAmount(this.getBalance());
System.out.println("Balance: " + balance);
}
}
public class SavingsAccount extends BankAccount {
public SavingsAccount(int accountnumber, String name, int balance) {
super(accountnumber, name, balance);
public SavingsAccount(int accountNumber, String name, int balance) {
super(accountNumber, name, balance);
this.Feesvalue(1.00);
}
......
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