I tried to do this for the ATM question and cracking my head for really long time but I really couldnt figure out what is the problem with my code. This is my first time submitting my own code. Hope to get to learn more from you guys!
import java.util.Scanner;
class ATM {
public static void main(String args[]){
Scanner input = new Scanner(System.in);
float withdraw;
float balance;
withdraw = input.nextFloat();
balance = input.nextFloat();
balance = (float) (balance - withdraw - 0.50);
if(withdraw % 5 == 0 && withdraw <= balance && withdraw >=0 && withdraw <= 2000){
System.out.println(balance);
}
else
{
balance = (float) (balance + 0.50 + withdraw);
System.out.println(balance);
}
}
}