First a few remarks: as you have seen in your original post the code didn't show
up correctly (no indentation). The forum software removes leading spaces in every
line except for lines (even a bunch of lines) embraced by [code] ... [/code]
tags. The error messages in your post could've looked like this:
-
C:\IBCS\CoinValues.java:11: '.class' expected
-
int cent = int count * int[i];
-
^
-
C:\IBCS\CoinValues.java:13: ']' expected
-
IB.output(count + " " + int[i] + " equals " + .cent + "cents.");
-
^
-
C:\IBCS\CoinValues.java:13: '.class' expected
-
IB.output(count + " " + int[i] + " equals " + .cent + "cents.");
-
^
-
-
class expected?
-
As you can see the caret ends up somewhere where you have seen it on your
screen as well instead of on the left side of the text. There's even no need to
remember this because when you compose your message you'll find a little
legend telling the same thing.
Now on to your compiler error diagnostics: what you fed to your compiler isn't
Java, it is nonsense to the compiler. Have a look:
- int cent = int count * int[i];
This defines an int variable 'cent' and you want to initialize it (the '=' sign introduces
an initializing value). But what is 'int count'? That doesn't yield a value which can
be converted to an int. There are too many errors in your code attempt to discuss
here. Read the first post in this forum named "Read This First". It contains a link
where you can download Sun's Java tutorial. I strongly advise you to download it
all and read it before you try to write some Java code. Programming is not guessing
what the language is supposed to be or hoping for what it should be.
kind regards,
Jos (moderator)