Commit a9ea10ca authored by Daniel Pearson's avatar Daniel Pearson

Origin

parent 398b66fa
No preview for this file type
No preview for this file type
...@@ -4,7 +4,7 @@ public class BankAccount { ...@@ -4,7 +4,7 @@ public class BankAccount {
int accountNumber; int accountNumber;
String name; String name;
float balance; float balance;
static Scanner myObj = new Scanner(System.in); static Scanner user = new Scanner(System.in);
//make it so it checks if the money is available in the account //make it so it checks if the money is available in the account
public BankAccount(int accountNumber, String name, float balance){ public BankAccount(int accountNumber, String name, float balance){
...@@ -26,7 +26,7 @@ public class BankAccount { ...@@ -26,7 +26,7 @@ public class BankAccount {
public static void deposit(BankAccount amount){ public static void deposit(BankAccount amount){
System.out.println("\n"+"\n"+"How much would you like to deposit? "); System.out.println("\n"+"\n"+"How much would you like to deposit? ");
float depositAmount; float depositAmount;
depositAmount = myObj.nextFloat(); depositAmount = user.nextFloat();
amount.balance += depositAmount; amount.balance += depositAmount;
System.out.println("Your total bank balance is: "+"£"+amount.balance); System.out.println("Your total bank balance is: "+"£"+amount.balance);
...@@ -36,7 +36,7 @@ public class BankAccount { ...@@ -36,7 +36,7 @@ public class BankAccount {
public static void withdrawal(BankAccount amount){ public static void withdrawal(BankAccount amount){
System.out.println("\n"+"\n"+"How much would you like to withdraw? "); System.out.println("\n"+"\n"+"How much would you like to withdraw? ");
float withdrawAmount; float withdrawAmount;
withdrawAmount = myObj.nextFloat(); withdrawAmount = user.nextFloat();
if(withdrawAmount < amount.balance) { if(withdrawAmount < amount.balance) {
amount.balance -= withdrawAmount; amount.balance -= withdrawAmount;
...@@ -77,13 +77,13 @@ class savingsAccount extends BankAccount{ ...@@ -77,13 +77,13 @@ class savingsAccount extends BankAccount{
savingsWithdrawal(dan); savingsWithdrawal(dan);
savingsBankFees(dan); savingsBankFees(dan);
savingsDisplay(dan); savingsDisplay(dan);
Scanner myObj1 = new Scanner(System.in); Scanner user = new Scanner(System.in);
} }
public static void savingsDeposit(BankAccount amount){ public static void savingsDeposit(BankAccount amount){
System.out.println("\n"+"\n"+"How much would you like to deposit? "); System.out.println("\n"+"\n"+"How much would you like to deposit? ");
float depositAmount; float depositAmount;
depositAmount = myObj.nextFloat(); depositAmount = user.nextFloat();
amount.balance += depositAmount; amount.balance += depositAmount;
System.out.println("Your total bank balance is: "+"£"+amount.balance); System.out.println("Your total bank balance is: "+"£"+amount.balance);
...@@ -93,7 +93,7 @@ class savingsAccount extends BankAccount{ ...@@ -93,7 +93,7 @@ class savingsAccount extends BankAccount{
public static void savingsWithdrawal(BankAccount amount){ public static void savingsWithdrawal(BankAccount amount){
System.out.println("\n"+"\n"+"How much would you like to withdraw? "); System.out.println("\n"+"\n"+"How much would you like to withdraw? ");
float withdrawAmount; float withdrawAmount;
withdrawAmount = myObj.nextFloat(); withdrawAmount = user.nextFloat();
if(withdrawAmount <= 100.0){ if(withdrawAmount <= 100.0){
if(withdrawAmount < amount.balance) { if(withdrawAmount < amount.balance) {
amount.balance -= withdrawAmount; amount.balance -= withdrawAmount;
......
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