+ 3
Help with the error in my JAVA code pls....
I have made a JAVA program on an ATM but the output is coming out as Invalid every time even when I enter the correct id and password.....Since this is a school project, they have instructed me not to use arrays.....due to which I am getting this difficulty.... Here's the code for the program..... https://code.sololearn.com/ct6qQ9ZtnHxl/#java Please help me in solving this error as soon as possible... Thanks in advance!
16 Respostas
+ 6
Yours inputs are defined as numbers (double and int). In this case, your line 29 is wrong:
if(id==003457001&&pw==1290)
correct is:
if(id==3457001&&pw==1290)
Maybe is better to define inputs as String, but that depends on your choices and decisions.
Nice code...keep coding :)
+ 4
After you update inputs as Strings use instead id=="003457001" id.equals("003457001")
It is same and with pw.
+ 4
Also, I recommend that you use trim() in input line : String id=in.nextLine().trim()
+ 4
Karan, please update all lines if( id=="... " &&pw=="...") with
if (id.equals("...")&&pw.equals("... "))
if you want that your code works fine :)
+ 4
Very nice code Karan.
But for Sololearn playground inputs (more than one line) is always confusing.
So, maybe will be good to put additional explanation (you already put some of) as:
Please input as:
id number (enter/next line)
password (enter/next line)
number of options (1,2 or 3) (enter/next line)
amount (submit)
What you think?
+ 3
@LukArToDo I just updated the code but still showing the same error.....chaech out the link in the description pls
+ 3
I do not know what to think 🤔
Nice app, but there are many ways to communicate, for those who want it.
+ 2
Then the account number has to be shortened isn't it
+ 2
Oh okay thanks bro
;)
+ 2
Thanks a lot bro....Seems like Sololearn saves me every time XD
And I just updated the code to a final one...
So just check it out!!
+ 2
Oh Sorry That code was an old one
Check this one
https://code.sololearn.com/cl3RW6UVe77F/#java
+ 2
Oh Alright.....No problem! I'll just copy-paste it now! ;D
+ 2
Hey @LukArToDo
Check this out...
https://www.sololearn.com/Discuss/689391/want-to-join-a-real-time-chat-for-sololearn
What do you think?
+ 1
It works! Just need to separate inputs with an ENTER
+ 1
Oh wait, even if the account number entered and passowrd is correct, it does not work
+ 1
Replace nextDouble with nextInt