Summing a sequence of fractions to a limit n Your method should accept a real number as a parameter representing a limit, and should add and print terms of the sequence until the sum of terms meets or exceeds that limit. For example, if your method is passed 2.0, print terms until the sum of those terms is at >= 2.0. You should round your answer to 3 digits past the decimal point.
  
  
    The following is the output from the call sequenceSum(2.0);
    1 + 1/2 + 1/3 + 1/4 = 2.083
  
  
  If your method is passed a value less than 1.0, no output should be produced. You must match the output format shown exactly; note the spaces and pluses separating neighboring terms. 


I'm wondering if there's anything I can do for the edge case of n = 1? It kinda just seems like it's hanging out at the end, and it looks a bit strange to me. Also, looking at the types for each value, I'm wondering if I need to think more about the data types I chose to use, in terms of should I use a double for this, or an int?.

I'd use methods to break out the functionality of my code, but the prompt only allows me to submit one method for this type of problem. Any feedback is appreciated!

public static void sequenceSum(double n){
    if(n &gt; 1.0){
        int denominator = 1;
        double accumulator = 0;
        System.out.print("1");
        while(accumulator &lt; n) {
            accumulator += ( 1.0 / denominator);
            if(denominator &gt; 1.0){
                System.out.print(" + " + 1 + "/" + denominator);
            }
        denominator++;        
        }
    System.out.printf(" = %1.3f", accumulator);
    } else if(n == 1.0){
        System.out.print("1 = 1.000");
    }
}
I'm wondering if there's anything I can do for the edge case of n = 1?


Yes, I think you are considering it to much (see below: you can simply remove some branching)


  Also, looking at the types for each value, I'm wondering if I need to think more about the data types I chose to use, in terms of should I use a double for this, or an int?.


I think your current choice is fine: int for the denominator and double for the accumulator.



Following your program (my comments adress the previous block of code):

public static void sequenceSum(double n){
    if(n &gt; 1.0){


I think you can simply remove this first condition (already well managed in the while loop)

        int denominator = 1;
        double accumulator = 0;
        System.out.print("1");
        while(accumulator &lt; n) {
            accumulator += ( 1.0 / denominator);
            if(denominator &gt; 1.0){


Your denominator is an int: you should compare it with 1 (and not 1.0)

                System.out.print(" + " + 1 + "/" + denominator);


You should integrate the 1 into the string: " + 1/".

            }
        denominator++;        
        }
    System.out.printf(" = %1.3f", accumulator);
    } else if(n == 1.0){


This branch can simply be replaced with a condition at the very beginning to check if n &lt; 1.0 and immediately return if it is the case.

        System.out.print("1 = 1.000");
    }
}


Miscellaneous

Instead of printing each time, you could append to a StringBuffer 

You have good variable names, except for n. Maybe sumLimit is more appropriate? (or accumulatorLimit).

Simplifying &gt; 1 conditions

You could start your denominator at 2 and your accumulator at 1.0, to get rid of the if condition inside your while loop (if n is 1.0, then the while loop will simply not be executed at all).