Using Methods 9/13, followed instructions but will not let me move on


#1



https://www.codecademy.com/en/courses/learn-java/lessons/object-oriented-programming/exercises/using-methods-1


There is no error message. The program correctly prints out "Woof" but the task still has a red X next to it.


class Dog {
	int age;

	public Dog(int dogsAge) {
		age = dogsAge;
	}

	public void bark() {
		System.out.println("Woof");
	}

	public static void main(String[] args) {
    
		Dog spike = new Dog(7);
		spike.bark();
	}
}


#2

Your code is missing one function,

public void run(int feet) {
System.out.println("Your dog ran " + feet + " feet!");

And a quite a number of function calls that refer to your defined functions,

spike.run(100);
int spikeAge =
spike.getAge();
System.out.println(spikeAge);
spike.checkStatus();


#3

I had the same problem. And I was getting so annoyed cuz I knew it was correct. This is so stupid, but you just have to change "Woof" to lower case 'w', "woof".


#4

I stuck on 9/13 too but I tried making the w lowercase and it did not work and I don't understand bandits code and where do I put it lol


#5

I'm stuck on this as well. Anyone?


#6

yes, answer correct is

spike.bark();


#7

I just restarted the exercise by the "get help" button and the code worked perfectly.


#8

i found the problem. in the method, you must write Woof! with the exclamation


#9

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