Monday, November 30, 2009

Using Google Sites

Using Google Sites:



Make a colorful, simple and user-friendly site. You will need to explain the following using words and code:

  1. Inheritance

  2. Interfaces

  3. ArrayList and Arrays

  4. Method overloading vs. overriding
Attach code samples to your site (zipped up Netbeans projects). Send me the URL when it is finished. If you copy other people's words, give them credit by linking to them and quoting it. Here's a site I've made.

Wednesday, November 25, 2009

Saturday, November 7, 2009

On tap for Monday...

  • Unit testing
  • Recursion (Chapter 13)

Monday, October 26, 2009

Wednesday, October 21, 2009

Monday, October 5, 2009

Today's minor project (in class)

With another person (or two, or by yourself), I would like you to create three classes for a Real Estate Business. The first will be a property class with an address, price, and area. The Residential class and Commercial class will be the subclasses of the Property class. Add two attributes to each subclass. ---Create a GUI to enter the information about the Residential or Commercial properties. Store them in an ArrayList.

Have the ability to output the ArrayList to the console.

Test Two is Monday October 12, 2009

Here is the review for the second test.

Wednesday, September 23, 2009

Presentations Chapter 7 through 10

Chapter 7



Chapter 8



Chapter 9



Chapter 10

Tell me the sum!

If we list all the natural numbers below 10 that are multiples of 3 or 5, * we get 3, 5, 6 and 9. The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.

Wednesday, September 16, 2009

Today

Examined subString, length with Strings
Used for loops to count down
Used while loops to count up
Used do while loops to enter nonnegative numbers.
Entered three numbers and found the sum and product.
Entered three numbers and found the largest number.
Determined whether a number is a multiple of 3 or 7.
Asked user for seven numbers and stored them in an array (using a loop).
Make a String array and store 3 people's names in it. Output the results.
Use the Scanner to enter the names from the console and store them in an ArrayList.
Make a ProgrammingStudent class that stores Name, programming ability, and ID.

Wednesday, August 26, 2009

Code for method

public void determineReorder(){
if(numToys <= 3)
{
System.out.println("Reorder the toy now");
}
else
{
System.out.println("The toy is in stock with " + numToys + " left!");
}
}

Monday, August 24, 2009

Before next class...

  1. Install Netbeans and Java on your home computer.
  2. Read this tutorial about objects: http://java.sun.com/docs/books/tutorial/java/concepts/object.html
  3. Download Thinking in Java:
    http://www.odioworks.com/download/TIJ-3rd-edition4.0.zip
  4. Try to purchase the class text. It is useful.
  5. Send me an email with the following information:

    What do you hope to gain from this class?
    What experience do you have with computers?
    What is your major?
    Any pertinent information you think is necessary.

    david.freer@gmail.com

Welcome to class!

Welcome to "Introduction to Java."

My name is David Freer.

Monday, July 27, 2009

Go to betterprogrammer.com

Try this fun test. Put on your blog how you do.

Write your impressions of the site on your blog and your score if available.

See how fast you can type

Put your WPM on your blog.

Click here. Do a 1 minute test and copy and paste the results on your blog.

Test completed - here are your results:
Net Speed: 78 WPM
(words/minute)
Accuracy: 98%
Gross Speed: 79 WPM
(words/minute)
Print results

Wednesday, July 22, 2009

Project euler code!

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package projecteuler;

/**

A palindromic number reads the same both ways.
* The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.

Find the largest palindrome made from the product of two 3-digit numbers.

*/
import java.util.*;
public class palindrome {

public static void main(String [] args)
{
//discover whether a number is a palindrome...

int first3digit = 1000;
int second3digit = 1000;

boolean keepGoing = true;
int counter = 0;
ArrayList arrayList = new ArrayList();
for(int i = 1000; i > 0; i--)
{
for(int j = 1000; j > 0; j--)
{
if(isPalindrome(i*j))
arrayList.add(i*j);
}
}
int largest = arrayList.get(0);
for(int x = 0; x< arrayList.size(); x++)
{
if(arrayList.get(x) > largest)
{
largest = arrayList.get(x);
}
}
System.out.println(largest + " is the largest");
/*
while(keepGoing == true)
{
if(isPalindrome(first3digit * second3digit))
{
System.out.println(first3digit);
System.out.println(second3digit);
counter++;
}

if(counter % 2 == 1)
{
--first3digit;
}
else
{
--second3digit;
}

if(counter == 1000000000)
{
keepGoing = false;
}

if(first3digit < 0 || second3digit < 0)
{
keepGoing = false;
}


// System.out.println(first3digit);
// System.out.println(second3digit);
counter++;
}
*/

}


public static boolean isPalindrome(Integer c)
{
String a = c.toString();
boolean b = true;
for(int i = 0; i < a.length()-1; i++)
{
if(a.charAt(i) == a.charAt(a.length()-i-1))
{
//System.out.println("We've got a match!");
}
else
{
b = false;
}
}
if(b == true)
{
System.out.println("This " + a + " is a palindrome.");
return true;
}
else
{
//System.out.println("This " + a + " is not a palindrome.");
return false;
}
}
}

Extra credit

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 99.

Find the largest palindrome made from the product of two 3-digit numbers.

Add 3 points to the final.

Searching through data

Selection sort
Insertion sort
Merge sort
Quicksort : how does it select the pivot value?
Binary search


Try to explain each algorithm in layman's terms and give the efficiency of the algorithm (Big O notation). Include a useful link if you found it.