what exactly is wrong with this code ? my code successfully runs all the test cases still submission says wrong answer !

import java.util.Scanner;

class Chefprac1 {

public static void main(String[] args) {
    Scanner obj=new Scanner(System.in);
    double bankcharge=0.50;
    
    
    String data=obj.nextLine();
    String []temp=data.split(" ");
    double originaldata[]=new double[temp.length];
    
    
    for(int i=0;i<temp.length;i++)
    {
    originaldata[i]=Double.parseDouble(temp[i]);
    }
    
    double amount=originaldata[0];
    double accountbal=originaldata[1];
    
    if((amount%5==0)&&(amount>0)&&(amount<=2000.00)&&(accountbal>0)&&(accountbal<2000.00)&&(amount<accountbal))
    {
    accountbal=accountbal-amount-bankcharge;
        
    System.out.printf("%.2f",accountbal);
        
    }
    else
    {
    System.out.printf("%.2f",accountbal);
    }
    
            
}

}

Okay, so your code is mostly right, although I would recommend you to inputs in a simple way, something like this

int amount = obj.nextInt();
double accountbal = obj.nextDouble();

it works fine, and also saves your time, alright to the main part now, the error in your code is in the line with the if statement, precisely where you are checking the condition amount< accountbal, you should also take into consideration the bank charge while checking this condition, so the correct way would be this

(amount+bankcharge)<accountbal)

after this, your code will work :slight_smile: Happy coding, don’t give up if you get some wrong answers, try to read the problem statement once again and go through your program manually.

//