BirdSighting Code

BirdSighting.java

/*
 * Mark Hesser
 * HesserCAN 
 * [email protected]
 * www.hessercan.com
 */
package birdsighting;
 
/**
 *
 * @author mark
 */
public class BirdSighting {
 
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
 
        Bird robin = new Bird();
        Bird duck = new Bird("duck", 91);
 
        System.out.println(String.format("The Bird Species is %s and it was found on %s", robin.getSpecies(), robin.getDate()));
        System.out.println(String.format("The Bird Species is %s and it was found on %s", duck.getSpecies(), duck.getDate()));
 
 
    }
 
}

Bird.java

/*
 * Mark Hesser
 * HesserCAN 
 * [email protected]
 * www.hessercan.com
 */
package birdsighting;
 
/**
 *
 * @author mark
 */
import java.text.SimpleDateFormat;
import java.util.*;
 
public class Bird {
 
    //Sets Date Format
    private final SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
    //Initilizes the Calendar
    private final Calendar c = Calendar.getInstance();
 
    private final String Species;
    private String Date;
 
    public Bird() {
        Species = "robin";
        this.setDate(0);
    }
 
    public Bird(String species, int day) {
        this.Species = species;
        this.setDate(day);
    }
 
    private void setDate(int day) {
        c.setTime(new Date(118,0,1)); //Sets Date to to January 1, 2018
        c.add(Calendar.DATE, day); //Adds number of days to date
        this.Date = sdf.format(c.getTime()); //Sets Date in String format
 
    }
 
    public String getSpecies(){
        return Species;
    }
 
    public String getDate(){
        return Date;
    }
 
}