Dog - public String getName() { return name; } //

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// **************************************************************** // Dog.java // // A class that holds a dog's name and can make it speak. // // **************************************************************** public abstract class Dog { protected String name; // ------------------------------------------------------------ // Constructor -- store name // ------------------------------------------------------------ public Dog(String name) { this.name = name; } // ------------------------------------------------------------ // Returns the dog's name // ------------------------------------------------------------
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: public String getName() { return name; } // ------------------------------------------------------------// Returns a string with the dog's comments // ------------------------------------------------------------public String speak() { return "Woof"; } // ------------------------------------------------------------// Require that subclasses have an avgBreedWeight method // ------------------------------------------------------------public abstract int avgBreedWeight(); }...
View Full Document

Ask a homework question - tutors are online