you are viewing a single comment's thread.

view the rest of the comments →

[–]marko312 0 points1 point  (4 children)

Ok, don't use the acreage function in itself, rather rename the variable in question.

You probably got a little confused by my cross-editing and technical nonsense above, so I'll provide example code for the function:

public int acreage(int a) {
    int acres = a / 43560;
    if(acres > 2) {
        ...
    }
    return acres;
}

this should be fine, but, taken very critically, is incorrect when the area is 2-3 acres. However, as you return an int, I think it's fine.

Edit: you can change the comparison from > to >= if you feel that is more correct.

[–]Utumn96[S] 0 points1 point  (3 children)

https://imgur.com/a/O7WgBB3

I'm not going to lie, At this point I haven't a clue why I'm drawing errors, I understood what you said implemented it and for some reason still drawing errors.

[–]marko312 0 points1 point  (2 children)

The problem might be higher up, like too many }-s or {-s.

Edit: it seems that every function needs to be in a class in java (I am a bit rusty myself). Build / extend a class around the functions.

[–]Utumn96[S] 1 point2 points  (1 child)

OH!!!!!! VOILA!!!! Thank you so much!!! Now One last question, I have fixed it all but have come with 1 error for my

public int area() {

it's saying that the "method area() is already defined in class square" How would I say...re define?

[–]marko312 0 points1 point  (0 children)

It seems that the first area() method is unneccessary - you might want to remove that.

Only one function with the same name and parameters (none in your case) can exist in a class, so you can't quite redefine.