Stag.java

  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package edu.nwmissouri.animalList;

  7. /**
  8.  * This is the Stag class which extends Animal
  9.  * @author Rahul Konda
  10.  */
  11. public class Stag extends Animal{
  12.    
  13.     /**
  14.      * Stag Constructor
  15.      * @param name - the name of this Stag
  16.      */
  17.     public Stag(String name){
  18.         super(name);
  19.     }
  20.      //@Override
  21.     public void eat(){
  22.         System.out.println("I'm CARNIVOROUS, I eat grass.");
  23.     }


  24.     @Override
  25.     public void speak(){
  26.         System.out.println("I'm a STAG, I have LONG HORNS!");
  27.     }
  28.     @Override
  29.     public void move() {
  30.         System.out.println("When I feel SUSPICIOUS, I RUN very fast!");
  31.     }
  32.      //@Override
  33.     public void color(){
  34.         System.out.println("I'm brown in colour with white spots on me");
  35.     }
  36.    
  37.     /**
  38.      * method for addition
  39.      */
  40.        public void access() {
  41.         double a = 2.5;
  42.         int b = 2;
  43.         double c = getStagAddition(a, b);
  44.         System.out.printf("I know StagAddition! %4.2f plus %d is %4.2f \n", a, b, c);
  45.     }

  46.     /**
  47.      *
  48.      * @param valueOne
  49.      * @param valueTwo
  50.      * @return
  51.      */
  52.     public double getStagAddition(double valueOne, int valueTwo) {
  53.         return valueOne + valueTwo;
  54.     }
  55.    
  56.      /**
  57.      * enum function with month values
  58.      *
  59.      */
  60.     public enum Months {
  61.         JANUARY,
  62.         FEBRUARY,
  63.         MARCH,
  64.         APRIL,
  65.         MAY,
  66.         JUNE,
  67.         JULY,
  68.         AUGUST,
  69.         SEPTEMBER,
  70.         OCTOBER,
  71.         NOVEMBER,
  72.         DECEMBER;
  73.     }
  74.    
  75.  
  76. }