Sunday, March 30, 2008

Funny pop up I just encountered...

Look familiar?

Thursday, March 27, 2008

Alternating counter

http://docs.google.com/Doc?id=dc65q8nz_407c6kgxbdp

Please upload to your FTP space!

Programming problems for your perusal!

Project Euler.

LoveTester!

Today we are going to be using NetBeans 6.0!

In class we did the following examples:

  • Print out to the console from info entered in a text field.
  • Ask a user for a number and give the user that number doubled.
  • Ask a user for a number and multiply it by a second number entered by the user.

To accomplish the second and third task we needed to first save the data (accessed on the text field with the .getText() method) and then parse the data (think casting!) as an integer.


Here's the code we used in class:

public void doubleNumber() {

numToMultiply = jTextField1.getText();
numToMultiplyBy = jTextField2.getText();
//Getting the info from the text field
numberToMultiply = Integer.parseInt(numToMultiply);
numberToMultiplyBy = Integer.parseInt(numToMultiplyBy);
finalNumber = numberToMultiplyBy * numberToMultiply;
//Double the number
// numToDouble = Integer.toString(numberToDouble);
//Convert the doubled number to a String
newNum.setText(Integer.toString(finalNumber));
// Set the label "newNum" with the doubled number!
}
private String numToMultiply, numToMultiplyBy;
private int numberToMultiply, numberToMultiplyBy, finalNumber;

The in-class assignment was to create a LoveTester that asks the user for 3-5 pieces of information about himself and 3-5 pieces of information about his lover. The complicated LoveTester Algorithm (patent pending) is going to reveal the level of attraction, lust, and love for the two people!

Tuesday, March 25, 2008

After the test, we are going to start designing with NetBeans

After the test, I would like you to begin designing with Netbeans. Since your next major project is about games, I want you to check out the Anagram example from the Welcome screen. Click on General under Sample Projects and then click on "Anagram game".