This commit is contained in:
2025-01-13 03:59:28 +03:00
parent a5b35aabb3
commit aea61f2076
14 changed files with 194 additions and 0 deletions

33
labs/lab7/Labrador.java Normal file
View 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;
}
}