11/13 - Stuck, need some help


#1

Not sure what I've been doing wrong. I tried to write according to what the first step had told me, but it hasn't been registering as correct. I don't get error messages in the black box next to the code, if that helps any.

Thanks.

//Create a Dog class
class Dog {
  
  int age;
  
  public Dog(int dogsAge) { 
    
    age = dogsAge;
    
  }
  
public void bark() {
      
      System.out.println("Woof!"); /** displays when program runs **/ 
      
    }
  
  public void run(int feet) { //amount of ft
    
    System.out.println("Your dog ran " + feet + " feet!"); // adds the int for ft ran, red code
    
     }
          public int getAge() {
    
          return age;
  }
  
     public static void main(String[] args) {
   
    Dog spike = new Dog(5);
    spike.bark();
    spike.run(2521620); //set amount
    }
}


#2

I completed succesfully and only difference I see between yours and mine are these two lines:

public int getAge() {
return age;
}

Try removing them and see if that works


#3

I removed and it is return age there still it doesnt work


#4

can you paste what you have plus the error you are getting?


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.