Source Code
Issues
public class FizzBuzz {
public static void main (String [] Args){
for(int i = 1; i<=100; i++){
getValue(i);
}
}
public static void getValue(int i){
if((i%3 == 0)&&(i%5 == 0)){
System.out.println("FizzBuzz");
}
else if(i%3 == 0){
System.out.println("Fizz");
}
else if(i%5 == 0){
System.out.println("Buzz");
}
else{
System.out.println(i);
}
}
}
Didn't have much difficulty with Eclipse since I've been using it for a while. It was probably made easier to accomplish since I witnessed it done in class. I first started working on the main and the "for" control statement, then moved on to make the method "getValue". The first time I did this in class I didn't read the instructions entirely so I was making the "FizzBuzz" conditional statement last and had to redo my if-else statement chain. This time I made sure I started that first. Another issue came up where Eclipse wanted me to make the "getValue" method static, probably because I was calling it within the same class. The last problem was in the formatting where the output wasn't line by line so I just added newline statements to the print.
Conclusion
It was nice to know that I could pass this screening test for decent programmers. I found that I should read the entire problem before jumping headlong into programming. From reading the other blogs, I found that I should have probably used a print line in the for loop and passed Strings to it from the getValue method.