That message was generated by some other piece of code - if you don't post that then nobody can help.
ps Your sumArgs method makes absolutely no sense whatsoever. Read More
Let's take this one step at a time:
Exactly which line of code does the error message refer to? (Post the whole error message - don't edit or summarise it) Read More
setAlpha is an instance method of the ICMA42 class. To call it you need an instance of ICMA42.
In your `this.setAlpha` the `this` refers to the current instance of whatever class that code was in, which obviously isn't ICMA42. That's what the error is syaing - whatever class `this` is … Read More
yes, but what is the problem? just replace
`this` by `pete`, as James already said. Read More
I get the idea.
Your test code creates an instance of ICMA42 and uses that to call ICMA's sumArgs method. That method is nonsense, but the way you call it is 100% correct.
You need to use the same instance of ICMA42 to call your setAlpha method. Not `this`, which … Read More
erictheonly: we understand the issue. James has already explained why it fails, and how to correct it.
"This needs to be done using BlueJ" -> this is irrelevant. code is not IDE dependent. Read More
ICMA42 pete = new ICMA42();
pete.sumArgs(); <<<<<<<<<<<<<<<<<<< recognises "pete"
this.setAlpha(42); <<< if you use pete here "it" will recognise it Read More
If you look at your code you will see:
the setAlpha method just sets that variable. It does not do anything to update the sum. You are still missing some of the code you were supposed to write.
Maybe this is your problem (or maybe not)
sum = alpha … Read More