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".

Sunday, March 23, 2008

Is Java so easy you can learn it while you drive to work?? What's the signifcance here?

I think the picture's kinda funny.

After your test you can work on these tutorials

Graphics tutorials from Sun.

Blog assignment #5: How do you comment when you write programs?

Blog assignment #5:

First, read this. On your blog, answer the following question: how do you comment when you are programming? Do you add attributes and methods to a class and then add comments at the end? Do you write comments as you code? Lastly, what did you think of the article. Title this blog post- Blog assignment #5.


Blog assignment #4:
The following blogs are very useful to aspiring computer scientists:

You are going to read through them and write three blog posts in reaction to their posts on your own blog. Provide a link to the post that you found interesting!

You may want to add them to your Google Reader account.

Blog assignments #1-3:
If you haven't done the first three blog posts, here are the links:

Wednesday, March 19, 2008

Check this out...

Java is being replaced...

Here's another resource if you don't have the book yet.

Tuesday, March 18, 2008

Lunch Cart Example

/*
* Class LunchCart-
*
* Attributes:
* totalProfit
* numSandwiches
* numSodas
* totalTaxes
*
*
* Methods:
*
*
* Class Employees(String employee_num, String emp_name, int hours_wked)
* Class Employees(String employee_num, String emp_name)
* {
*
* }
* Attributes:
* hoursWorked
* employeeNumber
* salary
*
*
* Methods:
* getTotalHoursWorked()
* setTotalHoursWorked()
* getEmployeeNumber()
*
*/
public class LunchCart {
//Input, output using Scanner
//Process data using relevant conditionals and/or looping.
//What's most important for the LunchCart!!

}

Add the guessing game to Google Documents

Add me as a viewer (david.freer@gmail.com) just paste your code from Eclipse into Google Docs.

Here's your guessing game Guessing.java assignment

//Write a guessing game with Java where the user guesses a number between one and 100 and
// you give tips based on how close or far they are. If they are 20+ digits away you can lol
//or if they are within 10-20, say they are within a decent range, otherwise say they are getting
//closer!

Thursday, March 13, 2008

Post URL for Tic Tac Toe code!

Under the layout of your blog add the code for links.

In the links add the URL to the Tic Tac Toe source code that you found. Title it "Tic Tac Toe Source Code".

First In-"Class" Assignment

Email me at david.freer@gmail.com all the necessary .java code for your first OO example. Can be zipped or not, your choice. Consider the BlueJ practice!

Assignment 1

To input data using Scanner!!!

Click here for the document.

Tuesday, March 11, 2008

Car.java

/*
* Car.java
*
* Created on March 11, 2008, 8:20 PM
*
* To keep accurate account of our cars.
*/

/**
*
* @author dfreer
*/
public class Car {

boolean start = false;
String engine = "";
String brake = "";
private String name = "Herbie";
/** Creates a new instance of Car */
public Car(String eng, String br, String n) {
//constructor
engine = eng;
brake = br;
name = n;
}

public String getEngine()
{
return engine;
}

public void changeEngine(String ch)
{
engine = ch;
}
public boolean startEngine()
{
start = true;
return start;
}

public String getName(){
return name;
}
public static void main(String [] args)
{
Car herbie = new Car("3.8L", "moderate", "George");
System.out.println(herbie.getEngine());
herbie.changeEngine("V8");
System.out.println(herbie.getEngine()+ " is the engine of the new and improved " + herbie.getName());
}
}

Introductions

A bit about you and what you expect from the course.

Chapter 2 Notes

Chapter 1 Notes

Monday, March 10, 2008

Install at home

Here's a good place to start.

What is the SDK? Here's a good place to start.

Download eclipse, netbeans, and bluej.

Download JDK 6 Update 5

Find five sites with Sun Certified practice questions online

Here's a sample.

Third post:

Find five sites that have sample Sun Certified Java Programmer questions and write a review of each of the sites on your blog.

Tuesday, March 4, 2008

First post:

As concisely as possibly describe on your blog the purpose of the following site:
Java API.

Second post:
What is the purpose of the Java Virtual Machine?