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
Step: 1
Get Instant Access to Expert-Tailored Solutions
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