Stefan Evans wrote:That is rather a cryptic error message.
Erroneus sym type: java.util.Scanner.nextint
== Erroneous sym type --> Erroneous Symbol --> You used the name of something that the compiler did not understand
It then tells you the name it can't understand: java.util.Scanner.nextint
Looking at the line of code, it is probably this one:
It doesn't like the nextint method here. What could be wrong with it?
Refer to the javadoc for java.util.Scanner class and see if you have spelled the method name correctly.
Case is important!
I'm just wondering what you are using to get this error message ? How are you writing, compiling and running this code?
I would suggest using "javac ProgrammingAssignment1.java" to compile it. That will probably give you better error messages.
RuntimeException means that something in java was actually running.
Campbell Ritchie wrote:I never knew you get compilation problem error messages in NetBeans as well as in Eclipse. Next time, you should believe the IDE when it tells you about errors. You should look at the code and you will probably find red marks against the lines with errors. You may even get hints about correcting them if you hover your mouse over the red marks.
You set up non‑integer numbers the same way you set up any other non‑integer. I presume you have come across floating‑point arithmetic? I presume you have read all the methods in the Scanner class?
By the way, run lines 8 and 9 together
int number = input.nextInt(); (etc)
Use variable names which mean something. A name like number is particuarly useless.
Stefan Evans wrote:Just some more feedback on code style/conventions.
I don't know if you get any marks for that in your assignments, but in my opinion you should :-)
Most of these might seem nit-picky but they are still important.
#1 Use of Capital Letters.
Classes start with a Capital letter. e.g. ProgrammingAssignment
Variables start with a lower case letter. e.g. investment, rate, years should all start with lower case letters.
After that each new 'word' should start with a capital. e.g. initialInvestmentAmount, interestRate, numberOfYearsToInvest
#2 indentation : looks good :-)
The 'magic' numbers 12 and 1200. What do they represent?
I presume 12 relates to the number of months in a year. Where does 1200 come from?
It would be nice to represent 'magic' numbers like these as constants.
i.e. public static final int MONTHS_IN_YEAR = 12
That last word may be permissible where you are writing but it isn't where I am reading; please avoid it in future.
Ansya Bluerose wrote: . . . my professor is a tricky little bugger . . .