So this is a hw assignment and I'm having a little trouble with it. I am a beginner (first programming class EVER) but I'm a quick learner so bare with me lol :-)
The assignment is to make 2 classes (done that part) one called gorilla and the other called cat. In gorilla are as follows:
-instance variables weight and name
-accessors and mutators for both instance variables
The problem I'm having because my prof wants us to make sure the mutator for weight CAN'T be set to a negative number
So here's my mutator for weight for gorilla:
public void setGweight(int x) { x != -0; //clearly Java DOES NOT agree with this statement }
Any ideas on how to fix this?
Thanks in advance! From one beginner to the pros and all...I can't wait to get better at this!