@@ -0,0 +1,2302 @@
+/** This program calculates green crud population numbers over a number of%0A *  days. The user inputs the number of days and the starting population in%0A *  pounds. The program assumes no deaths. The formula for the rate of growth %0A *  follows the Fibonacci number sequence. It also assumes 2 time periods to%0A *  mature to reproducing age and then one reproduction per time period. This%0A *  formula applies most directly toward asexual reproduction at a rate of one%0A *  offspring per time period.%0A */%0A%0Apackage greencrudpopulation;%0A%0A/**%0A *%0A * @author k8port%0A */%0Aimport java.util.Scanner;%0A%0Apublic class GreenCrudPopulation %7B%0A%0A    /**%0A     * @param args the command line arguments%0A     */%0A    %0A    // green crud time periods are 5 days%0A    private static final int TIME_PERIOD = 5;%0A    %0A    /** Iterative method for calculating the Fibonacci sequence %0A    *   of a certain length n.%0A    *   @param n The length of the sequence %0A    *   @return the next number in the sequence%0A    */%0A    private static int fibonacci(int n) %7B  %0A        int f1 = 1, f2 = 1, f = 1;%0A        if (n %3C= 0) %7B%0A            System.out.println(%22Error: argument must be a positive integer.%22);%0A            System.exit(0);%0A        %7D%0A        if (n == 1 %7C%7C n == 2)%0A            return 1;%0A        for (int i = 3; i %3C n; i++) %7B%0A            f = f1 + f2;%0A            f1 = f2;%0A            f2 = f;       %0A        %7D%0A        return f;%0A    %7D%0A %0A    public static void main(String%5B%5D args) %7B%0A        %0A        // instance variables%0A        Scanner scan = new Scanner(System.in);%0A        int pounds;     // original size in pounds of population%0A        int days;       // the number of days we wish to observe%0A        int fib;        // the length of the fibonacci sequence%0A        %0A        System.out.println(%22Please enter the size in pounds of the current population.%22);%0A        pounds = scan.nextInt();%0A        System.out.println(%22How many days will you be observing the population?%22);%0A        days = scan.nextInt();%0A        %0A        // Each time period is 5 days. Sequence advances every 5 days.%0A        fib = days / 5;  // will return the last day the population numbers changed%0A        %0A        System.out.printf(%22Population of the green crud after %25d days:%25n%22, days);%0A        System.out.println(fibonacci(fib) * pounds + %22 %22);%0A     %0A    %7D   %0A    %0A%7D%0A

Create GreenCrudPopulation.java