Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

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

}

public class BankTester { // identifier public static void main(String args[]);

//create bank account BankAccount bat = new BankAccount(); //deposit the 1000 bat.deposite(1000); //print the balance bat.print(); //withdraw the 500 bat.widthdraw(500); bat.print();

//widthdraw(400); bat.widthdraw(400);

bat.print();

}

Can Someone help with the error i get this in terminal.

"/BankTester.java:1: error: class, interface, enum, or record expected Public class BankAccount { ^ /BankTester.java:39: error: expected bat.deposite(1000); ^ /BankTester.java:39: error: illegal start of type bat.deposite(1000); ^ /BankTester.java:41: error: expected bat.print(); ^ /BankTester.java:43: error: expected bat.widthdraw(500); ^ /BankTester.java:43: error: illegal start of type bat.widthdraw(500); ^ /BankTester.java:44: error: expected bat.print(); ^ /BankTester.java:47: error: expected bat.widthdraw(400); ^ /BankTester.java:47: error: illegal start of type bat.widthdraw(400); ^ /BankTester.java:49: error: expected bat.print(); ^ 10 errors"

how can i fix this. thank you . If you cannot provide a solution dont answer thanks

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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