Question: This is the BankAccount Class Should not be changed public class BankAccount { private double balance; private String name; private int acctNumber; public BankAccount (String

This is the BankAccount Class

Should not be changed

public class BankAccount {

private double balance;

private String name;

private int acctNumber;

public BankAccount (String initName , int acct )

{

name=initName;

acctNumber=acct;

balance=0.0;

}

public void deposit(double amt)

{

balance=balance+amt;

}

public void withdraw(double amt)

{

balance=balance-amt;

}

public double getBalance()

{

return balance;

}

}

MY CODE THAT KEEPS GETTING ERROR THIS CAN BE CHANGED THE ABOVE CODE SHOULD REMAIN THE SAME.

public class BankTester {

// identifier

public static void main(String[] args){

//create bank account

BankAccount bat = new BankAccount("userTest",123);

//deposit the 1000

bat.deposit(1000);

//print the balance

System.out.println("Balance: " + bat.getBalance());

//withdraw the 500

System.out.println("Balance: " + bat.getBalance());

//widthdraw(400);

bat.withdraw(400);

System.out.println("Balance: " + bat.getBalance());

}

}

this is the error message "

-/workspaces javac BanKTester. java &8 java BankTester

BanKTester. java:20: error: cannot find symbol system.out.println ("Balance" + bat. getBalance) ;

symbol:

variable getBalance

location: variable bat of type BankAccount

BankTester. java:20: error: package system does not exist system.out.println("Balance" + bat.getBalance) ;

BanKTester. java: 26: error: package system does not exist system.out.printIn("Balance" + bat. getBalance ()) ;

BankTester. java: 32: error: cannot find symbol system.out.printin ("Balance" + bat. get. Balance ()) ;

symbol:

variable get

location: variable bat of type BankAccount

BankTester. java: 32: error: package system does not exist [system.out .println ("Balance" + bat. get. Balance ()) ;

5 errors"

Need help please and thank you. if you cannot provide a solution dont answer question please.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!