+ 3

What is wrong within this code?

//TODO code application logic here Scanner var= new Scanner(System.in); int pin; double initial, amount, sum, diff; int choice; initial = 5000.00; System.out.println("Enter your pin:"); pin=var.nextInt(); { choice=var.nextInt(); while(true) { .... int n = var.nextInt(); switch(n) { case 1: System.out.print("Enter Amount To Be Deposit:"); sum = var.nextInt(); if(initial<10000) ....

15th Oct 2019, 2:51 PM
Lorraine Jasten
Lorraine Jasten - avatar
11 Réponses
16th Oct 2019, 12:10 AM
Lorraine Jasten
Lorraine Jasten - avatar
+ 1
Delete the spike bracket above choice=var.nextInt(); Also change sum = var.nextInt(); to sum = var.nextDouble(); var.nextInt() will work for a double but there will be an error for user input if they enter a double.
15th Oct 2019, 2:56 PM
Odyel
Odyel - avatar
+ 1
I'm afraid it doesn't work that way
15th Oct 2019, 3:36 PM
Lorraine Jasten
Lorraine Jasten - avatar
+ 1
? Well, im only going off what im given
15th Oct 2019, 3:38 PM
Odyel
Odyel - avatar
+ 1
Well the first one doesn't work, and i still didn't work with the 2nd and thirda one, but still thanks though. Thank you very much
15th Oct 2019, 10:10 PM
Lorraine Jasten
Lorraine Jasten - avatar
+ 1
If you post the full code I might be able to find it
15th Oct 2019, 10:11 PM
Odyel
Odyel - avatar
+ 1
But there's a limited words in description, so i cannot.
16th Oct 2019, 12:02 AM
Lorraine Jasten
Lorraine Jasten - avatar
+ 1
Post it like this, you press the plus with the circle, insert code, tap the drop down tab in the corner and go to my codes https://code.sololearn.com/cl7R92MnWI67/?ref=app
16th Oct 2019, 12:05 AM
Odyel
Odyel - avatar
+ 1
Also for testing purposes how many inputs are needed?
16th Oct 2019, 12:07 AM
Odyel
Odyel - avatar
+ 1
I edited and commented in it on my pc so copy and paste it and it should work with what im given. https://code.sololearn.com/c1pNBBy1bKGo/?ref=app
16th Oct 2019, 12:52 AM
Odyel
Odyel - avatar
+ 1
If there is anymore problems you can just dm me or continue to post here
16th Oct 2019, 12:54 AM
Odyel
Odyel - avatar