Tuesday, January 1, 2008
Sunday, November 25, 2007
Thursday, November 15, 2007
What choices did you face in developing your solution, and how did you choose among them?
Like I have mentioned once before, which loop a programmer chooses is really critical. When I was making a Game today, I needed to use a loop in my program. I chose the while loop because the do while loop and the for loop were not really apropos for the program. I used a boolean to start up and I used the value of the boolean to state the control expression of the while loops. My loops were also nested, as that would take much lees coding than using loops that are not nested. Choosing nested while loops helped me keep my program limited and easily understandable.
Like I have mentioned once before, which loop a programmer chooses is really critical. When I was making a Game today, I needed to use a loop in my program. I chose the while loop because the do while loop and the for loop were not really apropos for the program. I used a boolean to start up and I used the value of the boolean to state the control expression of the while loops. My loops were also nested, as that would take much lees coding than using loops that are not nested. Choosing nested while loops helped me keep my program limited and easily understandable.
Wednesday, November 14, 2007
Provide yourself an example (not one from your instructor) of how you use a particular command that will help jog your memory in the future when you need that command again. You must provide a little code as well as a written explanation with this one.
A class called Random Generator helps programmers use random numbers and simulations in their programs. If you wanted to make a die that makes any number between 1 to 6 randomly, this class would be of great help. Look at the following example:
import java.util.Random;
public class Dies { public Dies (int s)
{
sides = s; generator = new Random();
}
public int cast()
{
return 1 + generator.nextInt(sides);
}
private Random generator;
private int sides; //private int sides2;
}
It a testing class was made, it would provide any random number between 1 and 6 just like a die would. Thus, the Random class is very important. (I am going to use it in the GameLand project.)
A class called Random Generator helps programmers use random numbers and simulations in their programs. If you wanted to make a die that makes any number between 1 to 6 randomly, this class would be of great help. Look at the following example:
import java.util.Random;
public class Dies { public Dies (int s)
{
sides = s; generator = new Random();
}
public int cast()
{
return 1 + generator.nextInt(sides);
}
private Random generator;
private int sides; //private int sides2;
}
It a testing class was made, it would provide any random number between 1 and 6 just like a die would. Thus, the Random class is very important. (I am going to use it in the GameLand project.)
Tuesday, November 13, 2007
What problems did you encounter while developing your solution? How do you plan to overcome them?/How did you overcome them?
While doing an assignment, I encountered a problem in which I thought everything was fine but the compiler kept on giving me unexpected answers. It is a program that asks the user for grades and calculates their GPA. The compiler kept on giving the wrong calculations although the code seems to be fine. I have not overcome the problem yet, but next class, I plan to scan the whole code and find the bug. It is probably an int / double problem.
While doing an assignment, I encountered a problem in which I thought everything was fine but the compiler kept on giving me unexpected answers. It is a program that asks the user for grades and calculates their GPA. The compiler kept on giving the wrong calculations although the code seems to be fine. I have not overcome the problem yet, but next class, I plan to scan the whole code and find the bug. It is probably an int / double problem.
Monday, November 12, 2007
What progress did you make today on your solution? What needs to be completed next class?
Today in class, I worked more on assignments dealing with loops, mostly nested loops. Working on these assignments helps me better understand how and when iterations are used. I used the apcslib library and nested loops to make very interesting pictures. By workings on these projects, I am able to extend my understanding of loops and how I might use them in real life. Next class I plan to work on more projects so that I will be even better when using loops.
Today in class, I worked more on assignments dealing with loops, mostly nested loops. Working on these assignments helps me better understand how and when iterations are used. I used the apcslib library and nested loops to make very interesting pictures. By workings on these projects, I am able to extend my understanding of loops and how I might use them in real life. Next class I plan to work on more projects so that I will be even better when using loops.
Friday, November 9, 2007
How did you go about testing your program? What were the results of that testing?
Today, I made a program that draws a circle that has 360 radii of different colors. When I first made the program, I found out that it did not draw all 360 radii as I intended it to. That was because I did not reset the direction back to 0. Once I did that, I saw a picture that has 360 radii perfectly aligned. To make them of different colors, I made the DrawingTool generate random colors by using the Math.random() method. Finally, the program turned out to be a very interesting an good looking one.
Today, I made a program that draws a circle that has 360 radii of different colors. When I first made the program, I found out that it did not draw all 360 radii as I intended it to. That was because I did not reset the direction back to 0. Once I did that, I saw a picture that has 360 radii perfectly aligned. To make them of different colors, I made the DrawingTool generate random colors by using the Math.random() method. Finally, the program turned out to be a very interesting an good looking one.
Subscribe to:
Posts (Atom)