public static void main(String a)
Scanner sc=new Scanner(System.in);
this code runs successfully in my pc but here i m getting runtime error, can any1 tell me whats wrong with code cuz m not able to figure it out…
As I see , you did manage to solve it , as one of your submissions is listed as correct answer .
The problem with the above code posted is that you are taking in nextDouble() first and nextInt() later . But the input comes first with an integer and then with a double . The way scanner works it always gives you the next available token and tries to cast it to the type you have asked for . So when nextDouble() is called you get the integer as a double value . And when nextInt() is called it throws InputMismatchException since its a double value and cannot be cast to integer .
This is an instruction on FAQ .
Your class containing the main method must be a public class called Main. It may not be called anything else.
But as I see @anu1293 has a submission to this ATM problem which is marked correct by CodeChef judge , but the class there is named Atm and not Main .