Hello to everyone,
I’m trying to submit the solution of ATM problem but i’ve got some runtime error that i can’t solve someone could help me?
import java.util.*;
class Atm
{
public static void main (String[] args)
{
double endAccountBalance;
double taxes = 0.50;
Scanner sc=new Scanner(System.in);
int amount = sc.nextInt();
double balance=sc.nextDouble();
if(balance < 2000)
{
if(amount%5==0 && (amount+taxes)<balance)
{
endAccountBalance = balance-amount-taxes;
System.out.println(endAccountBalance);
}
}
}
}
Above is my code…
This is the error:
Exception in thread "main" java.util.NoSuchElementException
at java.util.Scanner.throwFor(Scanner.java:862)
at java.util.Scanner.next(Scanner.java:1485)
at java.util.Scanner.nextInt(Scanner.java:2117)
at java.util.Scanner.nextInt(Scanner.java:2076)
at Atm.main(Main.java:12)
Many thanks for your support!
BR