@@ -0,0 +1,1255 @@
+package com.github.crazcalm.LearnAlgo.Chapter1.Excercises.Section1;%0A%0Aimport edu.princeton.cs.introcs.StdOut;%0A%0A/**%0A * Created by marcuswillock on 5/23/15.%0A */%0Apublic class Problem5 %7B%0A    public static void main(String%5B%5D args)%7B%0A        String question = %22Write a code fragment that prints true if %22 +%0A                %22the double variable x and y are both strictly between %22 +%0A                %220 and 1 and false otherwise.%22;%0A%0A        int lowerBound = 0;%0A        int upperBound = 1;%0A        double%5B%5D nums = %7B0.0, 0.1, 0.9, 1.2, 1.0, 0.000001, 0.99999999, 0.5%7D;%0A%0A        for(int i=0; i %3C 7 - 1; i++)%7B%0A            StdOut.print(%22doubles: %22);%0A            StdOut.println(%22(%22 + nums%5Bi%5D + %22, %22 + nums%5Bi+1%5D +  %22)%22);%0A%0A            StdOut.print(%22Answer: %22);%0A            if(Problem5.isDoubleInInterval(nums%5Bi%5D, nums%5Bi+1%5D, lowerBound, upperBound))%7B%0A                StdOut.println(%22true%5Cn%22);%0A            %7Delse%7B%0A                StdOut.println(%22false%5Cn%22);%0A            %7D%0A        %7D%0A    %7D%0A%0A    public static boolean isDoubleInInterval(double a, double b, int lowBound, int upBound)%7B%0A        boolean answer = false;%0A%0A        if ((lowBound %3C a && a %3C upBound) &&%0A                (lowBound %3C b && b %3C upBound))%7B%0A            answer = true;%0A        %7D%0A%0A        return answer;%0A    %7D%0A%7D%0A

finished questioned 5