Thursday, August 23, 2007

FizzBuzz Program

Ok, so I finally got the FizzBuzz program down. Here is the code:

public class FizzBuzzApp {
public static void main(String[] args) {
for ( int i = 1; i <= 100; 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 );
}
}
}



It took me about 20 minutes to finish this program, including the time I spent for the "hello world" tutorial in eclipse. The process went smoothly. Even though I haven't been programming in Java for quite a while, with the ease of eclipse, I did not encounter much difficulties.

Programming in eclipse reminds the first time I tried to use an IDE like VS.net, which I found it is really hard and unnecessary to to do my school programming work in a such gigantic monster-like software. What in the world is build? Why is to debug but not run? The simple "code-compile-run" method using in the notepad has already coined into my mind firmly. Until one time I saw one of my former professors to debug my program using the VS.net, then I finally notice the power of an IDE. Automatically complete the repeated code, setting break point and step forward in the program, open multiple windows to compare similar code sessions, etc. There are just so much more things we can do in IDE, and we can do them so much better, easier, and faster.

Thereafter, I strongly feel that if someone ever wants to do some serious programming, using an IDE is the only way to go. There is simply no reason to go back to notepad. Not at all.

No comments: