We are learning oop in my programming class and this was our first assignment for it, the problem I'm having is that it is only supposed to return "good" but i'm getting back "good 5". I'm still very new with all of this and would love some suggestions or tips on how to fix this.
public class Main{
public static void main(String[] args){
Dog dog = new Dog();
System.out.println(dog.checkWeight());
}
}
//Two seperate files main.java and Dog.java
public class Dog{
String name = "unknown";
String breed = "mutt";
int weight = 5;
public int checkWeight(){
if (weight <2){
System.out.println("under-weight");
}else if (weight > 10){
System.out.println("over-weight");
}else{
System.out.println("good");
}return weight;
}
}