Once I got the algorithm of the program, it took me about five minutes to type and fix my errors in Eclipse. I did not have any problems with Eclipse or Java because I had everything set up even before I took ICS 413.
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 % 5 == 0) {
System.out.println("Buzz");
} else if (i % 3 == 0) {
System.out.println("Fizz");
} else {
System.out.println(i);
}
}
}
}
Before I typed this code in Eclipse, Professor Johnson gave this problem to us as our first quiz to be written on a piece of paper. Without having done some Java coding in a while, I was clueless on how to code this problem. I got the algorithm correct but my mind is still fresh with all the scripting languages I learned last semester. I realized that I have to practice more so that I don't fall behind in the later assignments. I'm hoping to come out of this class with much better knowledge and techniques on developing softwares.
David Joel Lazaro
0 comments:
Post a Comment