Monday, March 30, 2009

Chapter 15



Read chapter 14 and chapter 15.

Grades

View grades here.

Chapter 14

Chapter 14

Define on your blog in your own words:


  1. Algorithm
  2. Selection sort
  3. Big O notation
  4. Insertion sort
  5. Merge sort

Look over the code but focus on concepts not coding.

Wednesday, March 25, 2009

Can anyone make sense of the recursive algorithm?

I was working on this problem:

A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are:

012 021 102 120 201 210

What is the millionth lexicographic permutation of the digits 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9?

and I found this page:

http://www.cut-the-knot.org/do_you_know/AllPerm.shtml

"Recursive algorithm

The recursive algorithm is short and mysterious. It's executed with a call visit(0). Global variable level is initialized to -1 whereas every entry of the array Value is initialized to 0.

void visit(int k)
{
level = level+1; Value[k] = level; // = is assignment

if (level == N) // == is comparison
AddItem(); // to the list box
else
for (int i = 0; i < N; i++)
if (Value[i] == 0)
visit(i);

level = level-1; Value[k] = 0;
}

"

Can anyone make sense of this?

DF
new wordsIveLearned(nameNew).setVisible(true);

Monday, March 23, 2009

Major Assignment 5 Due 4/5/09 on FTP

Instructions for Major Assignment 5 due 4/5/09.


Make this simpler?

/* * To change this template, choose Tools Templates * and open the template in the editor. */
package recursion;
/** * * @author dfreer */
public class Main {
public static void countDown(int x) {

//make a recursive method that counts down from itself until 0 and
//also prints out each number...go down by one!!
if(x == 0)
{

}
else
{
System.out.println(x);
countDown(x-1);
}
}

public static int calcMinimum(int [] a, int counter, int minimum)
{
if(counter == a.length-1)
{
if(a[a.length-1] < minimum)
{
return a[a.length-1];
}
else
return minimum;
}
else
{
if(a[counter] < minimum)
{
minimum = a[counter];
System.out.println("We got here!");
return calcMinimum(a, ++counter, minimum);
}
return calcMinimum(a, ++counter, minimum);
}
}

public static void main(String[] args) { // TODO code application logic here
int [] b = {7,16,23,-55}; //expecting -55
System.out.println(calcMinimum(b,0,b[0]));
//countDown(10);
//start counter at 0 and minimum at 0 }}

Wednesday, March 18, 2009

CarCustomers Minor Project

Today you are going to make a GUI application to keep track of the Name, Phone, Address, and whether a user has made a previous purchase before.

You can use a 3 Strings and a boolean.

Add the information to an ArrayList.

Have a button that will show the information that user has entered.

Four people finished it in class. Everyone else should upload it to their FTP space before March 25, 2009.

I will be in the computer lab (6103) at 2:30 on Friday to help people with this!

Hope to see you there.

Grades by id

View grades here.

Monday, March 16, 2009

Love Tester Minor Project *In class*

Using a Java GUI evaluate three pieces of information from Person A and three pieces of information from Person B.

Determine if they are a good match and output it to the GUI!

It doesn't have to be serious.

Minor project grade. Work with someone from class if you wish.

Due By March 23rd, 2009 on FTP.

What do you think of BlueJ?

Is it a good tool for teaching Java?

When you finish, try dling this:

http://www.davidcfreer.com/auction.zip

Try it out in BlueJ!

Please write a response on your blog...

http://moishelettvin.blogspot.com/2006/11/windows-shutdown-crapfest.html

Wednesday, March 4, 2009

MySQL and Netbeans

Download MySQL here.


CREATE TABLE address_books (first_name VARCHAR(25), last_name VARCHAR(25), phone_number VARCHAR(15), PRIMARY KEY (phone_number));

INSERT INTO address_books (first_name,last_name,phone_number) VALUES ('David','Freer','786-877-4573')";

-------Next, create a database for students using MySQL and a table with some information.

Then create a java program (using Netbeans) and show you are able to update it and delete data from the database.

Work with another classmate and upload it to your FTP space. However, when you finish call me over and I'll grade it in class.If you need numbers, you can use INT this.

Monday, March 2, 2009

Almost done grading the third major assignments...

For the next project please put your name in the comments of your classes. It will make grading it easier. I'll finish grading the third assignments tonight.

Your next project is due March 15, 2008.

It comes from Chapter 12 in the book.

Write a summary of (1) writing to a file and (2) read files with Java.

Write a brief post that describes how to write to a file and how to read in a file using Java.