Hey guys, Im having some trouble with this bit of code. Idk why but the last else in the String is marked as a syntax error. I've tried changing as much as possible but it doesn't seem to get fixed (btw ik its probably something really stupid but I recently started trying to code and can't figure this out for the life of me)
Thank you for using code tags but you didn't quite get them right. [code=java] goes before the code and [/code] after it. Since you are new I have corrected it; doesn't it look better
Please start methodNames with lowerCaseLetters. Not PlacaImpar(), but placaImpar() please.
You have doubtless been told that chars are letters, but they aren't. They are numbers which are displayed as letters corresponding to their ASCII/Unicode values. If they are numbers, you can do arithmetic with them, but I recommend you keep the arithmetic very simple. There is no need to use parseInt() if you can do this:-If you look up an ASCII table, or this Unicode page, you will find the digits have code numbers in order 0 1 2 3.... You can do the same with letters, but it only works for English writing, not French or Spanish because letters like é and ñ are in a different order.
I challenge you to find out why i % 2 == 0 will work and i % 2 == 1 sometimes won't. Actually, I would write the placaImpar() method like this:-Do you want those methods to be used by code outside your current class? If not, give them private access.