Sunday, August 30, 2009

04. FizzBuzz

The FizzBuzz program took me about 10 minutes to implement. I had actually been given a FizzBuzz assignment at my internship so I already had practice. However, it took me a while to finish because I was trying to write it in a different way. In the end though, this original solution seemed the most logical.

One problem I encountered was syntax errors. I originally wrote this program with a pencil and paper, and thus did not catch some errors. I realized what a difference IDE's such as Eclipse makes.

Even though this seemed like a simple program to write, I learned that software engineering starts at the basics. One must start off knowing the fundamentals and build on that in order to become a better programmer.


/**
* FizzBuzz
* Iterates through numbers 1 to 100
* Prints "FizzBuzz" when number is multiple of 3 and 5.
* Prints "Fizz" when number is multiple of 3.
* Prints "Buzz" when number is multiple of 5.
* Prints the number otherwise.
*/
public class FizzBuzz {
  
public static void main(String[] args) {
      
for (int i = 1; i <= 100; i++) {
          
if (i % 15 == 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);
          
}
       }
   }

}

02. Stellar + Planetarium = Stellarium

Package: Stellarium for Java

Source: http://sourceforge.net/projects/stellarium4java/

Download: http://stellarium4java.sourceforge.net/

Overview

Stellarium for Java is the Java version of Stellarium, an open source software that uses OpenGL to display 3D skies in real time. It shows things like stars, constellations, and planets.


Prime Directive 1

The functionality that Stellarium for Java provides is the same as Stellarium in that it can render the images in real time. The only difference is that Stellarium for Java uses the Java platform. Stellarium is also being used in planetariums.


Prime Directive 2

Downloading and installing Stellarium for Java was easy even for non-developers of the system like myself. After downloading the package it was easily installed with a single click. There are some requirements before installing the program such as certain versions of Java. However, there are links on the same download page on where to download these requirements.


Prime Directive 3

An external developer can also successfully understand and enhance the system. The source code is provided on the download page and the complete javadocs can be found on the development page.