Here is my code:

import java.util.*;

public class SavingAccount extends BankAccount
{	// Begin public class SavingAccount extends BankAccount
	private double minAmount;

    public boolean withdraw(double amount)
    {	// Begin public boolean withdraw(double amount)
        if (getbalance() >= amount + minAmount)
        {	// Begin if statement
            super.withdraw(amount);
            return true;
        }	// End if statement
        else
        {	// Begin else statement
            return false;
        }	// End else statement
    }	// End public boolean withdraw(double amount)

}	// End public class SavingAccount extends BankAccount

private int numberOfWithdrawals = 0;

public SavingAccount()
{	// Begin public SavingAccount
	balance = 0;
	numberOfWithdrawals = 0;
}	// End public SavingAccount

public void withdraw(int amount)
{	// Begin public voidwithdraw(int amount)
	if(numberOfWithdrawals > 4)
	{	// Begin if statement
		throw newRuntimeException(if the withdrawls >4 a service charge of 1$ is charged);
	}	// End if statement
	else
	{	// Begin else statement
		balance = balance amount;
		numberOfWithdrawals++;
	}	// End else statement
}	// End publicvoidwithdraw(int amount)

public void resetNumOfWithdrawals()
{	// Begin public voidresetNumOfWithdrawals()
}	// End public voidresetNumOfWithrawals()

I am getting the following class, interface, or enum expected error messages:

java:23: class, interface, or enum expected
private int numberOfWithdrawals = 0;
^
java:25: class, interface, or enum expected
public SavingAccount()
^
java:28: class, interface, or enum expected
numberOfWithdrawals = 0;
^
java:29: class, interface, or enum expected
} // End public SavingAccount
^
java:31: class, interface, or enum expected
public void withdraw(int amount)
^
java:36: class, interface, or enum expected
} // End if statement
^
java:40: class, interface, or enum expected
numberOfWithdrawals++;
^
java:41: class, interface, or enum expected
} // End else statement
^
java:44: class, interface, or enum expected
public void resetNumOfWithdrawals()

Please help!

Well, even your comments declare that you are "ending" a class, then you continue to declare variables and methods? To which class are those to belong?

I'm trying to use those as local variables. I did get the error at line 23 to go away by moving it to the top of the program below "private double min amount" but I don't know why I have the rest of the errors. I did my bank acount program and that compiled fine.

All your methods and variables must be inside a class. On line 20 you have the } that ends the class definition, so everything after that is NOT in a class.
Once you have closed a class definition with its final } the only things can can follow are a new class, interface or enum.
Once again - all your variables and methods must be placed between your
{ // Begin public class SavingAccount extends BankAccount
and your
} // End public class SavingAccount extends BankAccount

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.