what is the problem in this code

package ATM;

public class Example
{
double newBalance;
public double operation(double balance,double withdrawl)
{

if(withdrawl%5 !=0)
{
	System.out.println("Please Withdraw in multiple of 5");
}	
else if(withdrawl>balance+0.50)
{
	System.out.println("Not Enough Money");
}
else
{
	System.out.println("Withdrawl Successful");
	newBalance=balance-(withdrawl+0.50);
}	

return newBalance;
}
public static void main(String args[])
{
Example ex=new Example();
double balance=200;
double w=25;
double newbalance=ex.operation(balance,w);
if(newbalance!=0.00)
{
System.out.println(newbalance);
}
else
{
System.out.println(balance);
}
}

}

@chiragkalia : You dont have to declare package name . You should read FAQ’s regarding submission guidelines for various languages . Also the class name should be “Main” and nothing else .

Hello,

If that code is for the ATM problem, you should follow the Input and Output formats described strictly as they are given on problem description.

Namely, all the “rubbish” you are printing to stdout, like: System.out.println("Not Enough Money");, System.out.println("Withdrawl Successful"); etc, should be totally removed in order to get AC!

Good luck,

Bruno

Yes , i didn’t notice that you are printing messages . You program should not print anything apart from the required output . Remember you program will be judged by a machine and it has to match required output character by character .