+ 1

Error

I'm trying to make a program that gives a few interview questions, there is a question that involves an integer to be inputted but it keeps giving me an error related to an operand here's the link to the code https://code.sololearn.com/cUQD29D4W1a9/?ref=app

7th Aug 2018, 4:21 AM
idris
8 Antworten
+ 2
PRAMOD JANA Look at the code now and try to run it and look at where money was at
7th Aug 2018, 5:27 AM
idris
0
money is an object name and you have initialized it with an integer that's why it is showing error...
7th Aug 2018, 5:24 AM
PRAMOD JANA
PRAMOD JANA - avatar
0
PRAMOD JANA i also had an identifier by the name of "Amount" and i was still receiving errors
7th Aug 2018, 5:25 AM
idris
0
PRAMOD JANA i also had replaced Money.nextLine with Amount.nextLine when i was working on the program and still got errors
7th Aug 2018, 5:28 AM
idris
0
PRAMOD JANA The only way it would work is if i give Amount a value but i don't want to give it a value simply... let me show an example: int amount = 0; if (amount > 500) you see that? it's a 0 of course it won't be greater than not to mention they will have to put any amount of money, and also no matter what you put as an input 0 will always be the default value so it's not going to work even if i didn't have money as an object
7th Aug 2018, 5:32 AM
idris
0
that's why i didn't want to add a value because that value will always be the default value and i only want it to calculate the number they input and say whether or not it's out of range instead of me having to input it for them
7th Aug 2018, 5:36 AM
idris
0
why you are taking input in print statement
7th Aug 2018, 2:25 PM
PRAMOD JANA
PRAMOD JANA - avatar
0
you should take the input in amount
7th Aug 2018, 2:26 PM
PRAMOD JANA
PRAMOD JANA - avatar