need help to find public object[] public class BankAccount { private double balance; private String accountNumber; private Customer customer; public BankAccount() { this(0.0); } public
need help to find public object[]
public class BankAccount { private double balance; private String accountNumber; private Customer customer;
public BankAccount() { this(0.0); }
public BankAccount(double balance) { this(balance, "0001"); }
public BankAccount(double balanceToStart, String accountNumberToStart) { this(balanceToStart, accountNumberToStart, new Customer("Unknown")); }
public BankAccount(double balance, String accountNumber, Customer customer) { this.balance = balance; this.accountNumber = accountNumber; this.customer = customer; }
public BankAccount(Customer c, double d) { customer = c; balance = d; // TODO Auto-generated constructor stub }
public BankAccount(BankAccount b) { this(b.balance,b.accountNumber,b.customer); // TODO Auto-generated constructor stub }
public double getBalance() { return this.balance; }
public String getAccountNumber() { return this.accountNumber; }
public String toString() { return "(" + customer + ") " + this.getAccountNumber() + ": " + this.getBalance(); } public void deposit(double amount) { if (amount >= 0) { double check = this.balance + amount; this.balance = check; } }
public void withdraw(double amount) { if (amount >= 0 && this.balance >= amount) { this.balance = this.balance - amount; } }
public void transfer(BankAccount account, double amount) { if (amount >= 0 && this.balance >= amount) { account.deposit(amount); withdraw(amount); } }
public void setAccountHolder(Customer customer2) { customer = customer2; // TODO Auto-generated method stub }
public void transfer(int i, BankAccount b2) { if (i >= 0 && this.balance >= i) { b2.deposit(i); withdraw(i); } } // TODO Auto-generated method stub
public Object[] getAccountHolder() {
return null; } }
import static org.junit.Assert. public class BankAccountIA3Test // test constructors @Test public void test_creation ){ BankAccount b- new BankAccount); assertEquals("Expected initial balance to be 0.0", 0.0, b.getBalance(), 0.0001); String actualAccountNumber-b.getAccountNumber); assertEquals("Account number should have exactly length 4 (4 digits)", 4, actualAccountNumber.length)); int num -Integer.parseInt (actualAccountNumber); assertTrue("Account number should be a number between 1 and 9999 (inclusive)", 1 ", "(Alan Turing 123) 3426: 101.56", b.tostring()); import static org.junit.Assert. public class BankAccountIA3Test // test constructors @Test public void test_creation ){ BankAccount b- new BankAccount); assertEquals("Expected initial balance to be 0.0", 0.0, b.getBalance(), 0.0001); String actualAccountNumber-b.getAccountNumber); assertEquals("Account number should have exactly length 4 (4 digits)", 4, actualAccountNumber.length)); int num -Integer.parseInt (actualAccountNumber); assertTrue("Account number should be a number between 1 and 9999 (inclusive)", 1 ", "(Alan Turing 123) 3426: 101.56", b.tostring())Step by Step Solution
There are 3 Steps involved in it
Step: 1
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started