10/13 Please help me with this exercise


#1

Hello,

I´m new here and I mostly solved the problem when there was one, when not i just looked it up in the forum but i couldn´t solve the problem in this exercise. I don´t get an error but I get this:

_Did you create the run method? Place it between the bark and main method._

I even restarted the exercise but I´m still stuck with the same thing, I hope you can help me

 class Dog {
  
  int age;

	public Dog(int dogsAge) {
    
  	age = dogsAge;
    
  }
  
  public void bark() {
		
    System.out.println("Woof!");
    
	}
  
  public void run(int feet) {
    
    System.out.println("Your dog ran " + feet + " feet!");
    
  }

	public static void main(String[] args) {
    
    Dog spike = new Dog(5);
    spike.bark();
    spike.run(10);

	}

}

#2

I don't know if you already solved it but I don't see the feet variable being set to any thing. You called it in the "Run" class but I don' know if you it is set to an actual integer.


#3

uhm.. I didn´t solve it yet. Yes in the run method i wrote int feet. Is that wrong?


#4

Okay.. i solved it. For everyone: you have to do it step by step. After each instruction you have to click on run:)


#5

so what am i doing wrong? ( this is the first step

class Dog {

int age;

public Dog(int dogsAge) {
age = dogsAge;

}

public void bark() {

System.out.println("Woof!");

}

public void run(int feet) {

public static void main(String[] args) {

Dog spike = new Dog(5);
spike.bark();

}
}


#6

Hi Guys,

Can anyone help me and point me out the error?

I am still getting this error message:

"Did you create the run method? Place it between the bark and main method."

My Code is as follows:

class Dog {

int age;

public Dog(int dogsAge) {
age = dogsAge;

}

public void bark() {

System.out.println("Woof!");

}

public void run(int feet) {

System.out.println("Your dog ran " + feet + " feet!");

}

public static void main(String[] args) {

Dog spike = new Dog(5);
spike.bark();
spike.run(40);

}

}


#7

Thank u. i solved it.
mybe,it's a bug.


#8

Still not working for me, I am stuck, I even click on "Get Code" but it is not working!!!

Any Ideas??


#9

This exercise worked for me if I ran after each step. So step 1, then run. Step 2, then run. And so on...


#10

Ok, worked, but I had to reset the exercise like 3 times. :frowning:


#11

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