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);
}
}
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.
“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);
}