Advertisement
nadejdachitakova

AbstractClassAnimal

Feb 17th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. package uni.fmi.bachelors;
  2.  
  3. public abstract class Animal {
  4.  
  5.     private String type;
  6.     private int population;
  7.     private String habitat;
  8.     private double height;
  9.    
  10.     public Animal(String type, int pop) {
  11.         this.type = type;
  12.         population = pop;
  13.     }
  14.    
  15.     public Animal(String type) {
  16.         this.type = type;
  17.     }
  18.    
  19.     public abstract void moveTo(String to);
  20.     public abstract void eat();
  21.  
  22.     public String getType() {
  23.         return type;
  24.     }
  25.  
  26.     public void setType(String type) {
  27.         this.type = type;
  28.     }
  29.  
  30.     public int getPopulation() {
  31.         return population;
  32.     }
  33.  
  34.     public void setPopulation(int population) {
  35.         this.population = population;
  36.     }
  37.  
  38.     public String getHabitat() {
  39.         return habitat;
  40.     }
  41.  
  42.     public void setHabitat(String habitat) {
  43.         this.habitat = habitat;
  44.     }
  45.  
  46.     public double getHeight() {
  47.         return height;
  48.     }
  49.  
  50.     public void setHeight(double height) {
  51.         this.height = height;
  52.     }  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement