some help with inheritance

i am trying to write a program that "Store a value in the monetary coin that represents its value and add a method that returns its value."

i have started to write the program but when i compile it i get an error about "incompatible types."

Here is my program so far, can someone help me:

[code]public class MonetaryCoin extends Coin{

protected int value;

public MonetaryCoin(int faceValue){
value = faceValue;

public int getMonetaryCoin(){
return value+super.flip();



  • Jo,
    Without knowing all the classes in your application, ie. the Coin class, and not knowing what statement the error is pointing to this suggestion is only a guess.
    The guess is that the error is pointing to this line,
    [code]return value+super.flip();[/code]
    because the method super.flip does not return an "int".

    It is not clear why the method super.flip is part of the return statement.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion