lab7
This commit is contained in:
33
labs/lab7/Labrador.java
Normal file
33
labs/lab7/Labrador.java
Normal file
@ -0,0 +1,33 @@
|
||||
// ****************************************************************
|
||||
// Labrador.java
|
||||
//
|
||||
// A class derived from Dog that holds information about
|
||||
// a labrador retriever. Overrides Dog speak method and includes
|
||||
// information about avg weight for this breed.
|
||||
//
|
||||
// ****************************************************************
|
||||
public class Labrador extends Dog
|
||||
{
|
||||
private String color; //black, yellow, or chocolate?
|
||||
private int breedWeight = 75;
|
||||
|
||||
public Labrador(String name, String color)
|
||||
{
|
||||
super(name);
|
||||
this.color = color;
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// Big bark -- overrides speak method in Dog
|
||||
// ------------------------------------------------------------
|
||||
public String speak()
|
||||
{
|
||||
return "WOOF";
|
||||
}
|
||||
// ------------------------------------------------------------
|
||||
// Returns weight
|
||||
// ------------------------------------------------------------
|
||||
public int avgBreedWeight()
|
||||
{
|
||||
return breedWeight;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user