HS08TEST: Getting WA

I have got a solution for this problem, and I have got the right output, but the checker tell me it is wrong answer:

import java.util.Scanner;
class Atm {
    public static void main(String[] args) {
    Scanner bill=new Scanner(System.in);
    String darabol[] = null;
    String beolvas=bill.nextLine();
    darabol=beolvas.split(" ");
    double darabolszt[] = new double[darabol.length];
    for(int i=0;i0 && darabolszt[0]<2000)
    if(darabolszt[1]>0 && darabolszt[1]<2000)
    else if(darabolszt[0]>darabolszt[1]){


I can explain you the procedure for that problem in C++.

But if your question is to find out bug in your java program. Hope for someone else to help :slight_smile:

Comparing both the programs ( Algorithms ) will let you know the mistake.

Look out the comments in program for explanation :slight_smile:

Happy Coding :slight_smile:

#include <iostream>
using namespace std;
int main()
int p;
float q;
cin>>p>>q;       //Scan In Inputs
if(p%5!=0)       //Check if p is a multiple of 5
cout<<q<<endl;   //If not, Transition is not valid, And so just print q value
else if(p+0.5>q) //Check if there are enough funds. +0.5 for cutting charges
cout<<q<<endl;   //Again if not print q;
else             //So finally all conditions satisfied
q=q-p-0.5;       //Deduce the amount
cout<<q<<endl;   //Print q
return 0;
1 Like

this test is unfortunately wrong.

you should consider the corner case when there is not enough money to include the fee of the withdrawal. :slight_smile:

Generally you should use english variable, function name it would more easy to read your code who are not hungarian :slight_smile:


Please accept an answer (by clicking on the tick on the left side of the answer) if you think your question has been answered. If not, please comment on the answer requesting clarification.