ATM java problem

**import java.io.*;
class work
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int X;double Y;
X=Integer.parseInt(br.readLine());
Y=Double.parseDouble(br.readLine());
if(X%5==0&&X<=Y)
{
double d=Y-(X+.50);
System.out.println(d);
}
else
System.out.println(Y);
}
}

RUN TIME ERROR IS SHOWN WIT THE MASSEGE NECZ OR SOME THING LIKE THIS .PLZ POINT OUT THE ERROR AND DESCRIBE PLEASE

using bufferedReader sometimes causes problems when you have to take input simultaneously.
use split(" ").

import java.io.*;
class work
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int X;double Y;
String[] ar = br.readLine().split(" ");
X=Integer.parseInt(ar[0]);
Y=Double.parseDouble(ar[1]);
if(X%5==0&&X<=Y)
{
double d=Y-(X+.50);
System.out.println(d);
}
else
System.out.println(Y);
}
}

I checked your last solution, import java.io.*; was missing.

After adding this line, the compilation error was removed. Then it showed Wrong answer.

This was due to the condition if(X%5==0&&X<=Y)

Correction: if(x%5==0&&X+0.5<=Y) ,[ this because 0.5 is also to be deducted from the balance]
Here is the corrected solution link: http://www.codechef.com/viewsolution/4377785

import java.util.Scanner;
import java.io.*;

class Transaction{

public void transaction(int amount, double balance)
{
	double interest = 0.50;
	if(amount+interest<=balance && amount%5==0)
	{
		
		
			amount += interest;
			double d = balance-amount;
			System.out.println(d);
	}
	else{
			System.out.println("Incorrect Withdrawl amount: "+balance);
		}
}

}

class ATM {
public static void main(String[] args) throws IOException
{
Transaction trn = new Transaction();
double balance;
int amount;
// System.out.println("Enter amount you want to withdrawl: " +"Main Balance is: "+balance);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

	String[] ar = br.readLine().split(" ");
	amount = Integer.parseInt(ar[0]);
	balance = Double.parseDouble(ar[1]);
	 trn.transaction(amount, balance);
}

}

not working

thank you very much brother

Welcome! if you feel the question is being answered correctly, then accept the answer.

/* package codechef; // don’t place package name! */

import java.util.;
import java.io.
;

class code
{
public static void main(String args[])throws IOException
{
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
double amount;
double bal;
double rem;

    amount = Double.parseDouble(br.readLine());
    System.out.println("Amount");
    bal = Double.parseDouble(br.readLine());
      System.out.println("Balance");
      rem = Double.parseDouble(br.readLine());
      {
          if (amount<bal)
          {
              while(amount%5==0)
              {
             System.out.println("Remaining balance"+ (amount-bal));
             
              }
              System.out.println(bal);
          }
      }
    
}

}
/* package codechef; // don’t place package name! */

import java.util.;
import java.io.
;

class code
{
public static void main(String args[])throws IOException
{
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
double amount;
double bal;
double rem;

    amount = Double.parseDouble(br.readLine());
    System.out.println("Amount");
    bal = Double.parseDouble(br.readLine());
      System.out.println("Balance");
      rem = Double.parseDouble(br.readLine());
      {
          if (amount<bal)
          {
              while(amount%5==0)
              {
             System.out.println("Remaining balance"+ (amount-bal));
             
              }
              System.out.println(bal);
          }
      }
    
}

}