Advertisement
Guest User

Untitled

a guest
Aug 28th, 2014
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.76 KB | None | 0 0
  1. package five;
  2.  
  3. public class SledDog extends Dog {
  4.     // David Mix Barrington, for discussion of 10 Oct 2012
  5.      
  6.        private String breed;
  7.        public SledDog (String n, int a, String b) {
  8.           super (n, a);
  9.           breed = b;}
  10.        public SledDog (String n, int a) {
  11.           this (n, a, "Husky");}
  12.        public void setBreed (String b) {
  13.           breed = b;}
  14.        public String getBreed ( ) {
  15.           return breed;}
  16.  
  17.        public String toString( ) {
  18.           String out = "";
  19.           out += name;
  20.           for (int i = name.length( ); i <= 13; i++) out += " ";
  21.           String ageString = Integer.toString(age);
  22.           for (int i = ageString.length( ); i <= 5; i++) out += " ";
  23.           out += ageString;
  24.           out += "   ";
  25.           out += breed;
  26.           return out;}
  27.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement