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/Dog.java Normal file
View File

@ -0,0 +1,33 @@
// ****************************************************************
// 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
// ------------------------------------------------------------
public String getName()
{
return name;
}
// ------------------------------------------------------------
// Returns a string with the dog's comments
// ------------------------------------------------------------
public String speak()
{
return "Woof";
}
public abstract int avgBreedWeight();
}