Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need help debug public class BankAccount { private double balance; private String accountNumber; private Customer customer; public BankAccount() { this(0.0); } public BankAccount(double balance) {

need help debugimage text in transcribed

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); }

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; }

public void transfer(int i, BankAccount b2) { if (i >= 0 && this.balance >= i) { b2.deposit(i); withdraw(i); } }

public Object[] getAccountHolder() { String arr = customer.getName(); Object[] data = new Object[arr.length()]; for(int i = 0; i

} }

The following specific error(s) were discovered while compiling reference tests against your submission: Assignments/IA3/BankAccountIA3Test.java: 88: error: cannot find symbol assertEquals("Unexpected customer", "John Doe", b.getAccountHolderO.getNameO) synbo method getNameO location: class Object[] Assignments/IA3/BankAccountIA3Test.java: 100: error: cannot find symbol assertEquals("Unexpected customer name in copy", "Ada Lovelace", copy.getAccountHolderO.getNameO); synbol method getNameO location: class Object ] Assign ents/IA3/BankAccountIA3Test.java: 101: error: cannot find symbol assertEquals("Unexpected customer id in copy", 41, copy.getAccountHolder O.getIDO); synbol: method getIDCO location: class object] Assignments/IA3/BankAccountIA3Test.java: 114: error: cannot find symbol assertEquals("Unexpected customer name in copy", "Name Changed", copy.getAccountHolderO.getNameO); synbol method getNameO location: class Object [] Assignments/IA3/BankAccountIA3Test.java: 125: error: cannot find symbol assertEquals("Unexpected customer name in copy", "Grace Hopper", copy.getAccountHolderO.getNameO); synbol method getNameO location: class Object ] Note: /usr/local/ton cat/temp/-GraderCheckout/11169/Course/UofCCPSC. 219/Individual Note: Recompile with -X1int:deprecation for details 5 errors Assignments/1A3/BankAccount!A3Test, java uses or overrides a deprecated API

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions