Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package five;
- public class SledDog extends Dog {
- // David Mix Barrington, for discussion of 10 Oct 2012
- private String breed;
- public SledDog (String n, int a, String b) {
- super (n, a);
- breed = b;}
- public SledDog (String n, int a) {
- this (n, a, "Husky");}
- public void setBreed (String b) {
- breed = b;}
- public String getBreed ( ) {
- return breed;}
- public String toString( ) {
- String out = "";
- out += name;
- for (int i = name.length( ); i <= 13; i++) out += " ";
- String ageString = Integer.toString(age);
- for (int i = ageString.length( ); i <= 5; i++) out += " ";
- out += ageString;
- out += " ";
- out += breed;
- return out;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement