Difference between revisions of "IB Computer Science 2"

From WLCS
Line 1: Line 1:
== Monday (9/24/12) ==
+
== Wednesday (9/26/12) ==
* Introduction to Selection Sort
+
'''Warmup:'''
# Find the smallest element
+
 
# Move to the front of the array (swap with front)
+
 
# Repeat Steps 1&2, but ignoring the sorted front
+
'''Agenda:'''
* [http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html Selection Sort Animation]
 
* [http://www.cs.ust.hk/faculty/tcpong/cs102/summer96/aids/select.html Another Selection Sort Animation]
 
* [http://math.hws.edu/TMCM/java/xSortLab/ Sorting Animations]
 
* Download [[Media:SelectionSort.java]]
 
** Fill in the commented parts of the SelectionSort.java file. Where there is a comment, you need to write code.
 
* Demo SelectionSort
 
 
* Add a (s)ort option to your AddressBook
 
* Add a (s)ort option to your AddressBook
 
** In order to compare Strings:
 
** In order to compare Strings:
Line 22: Line 16:
 
if (myContacts[i].getLastName().compareTo(myContacts[j].getLastName()) < 0)
 
if (myContacts[i].getLastName().compareTo(myContacts[j].getLastName()) < 0)
 
</source>
 
</source>
 +
 +
== Monday (9/24/12) ==
 +
* Introduction to Selection Sort
 +
# Find the smallest element
 +
# Move to the front of the array (swap with front)
 +
# Repeat Steps 1&2, but ignoring the sorted front
 +
* [http://math.hws.edu/TMCM/java/xSortLab/ Sorting Animations]
 +
* [http://www.cs.oswego.edu/~mohammad/classes/csc241/samples/sort/Sort2-E.html Another Selection Sort Animation]
 +
* [http://www.cs.ust.hk/faculty/tcpong/cs102/summer96/aids/select.html Another Selection Sort Animation]
 +
* Download [[Media:SelectionSort.java]]
 +
** Fill in the commented parts of the SelectionSort.java file. Where there is a comment, you need to write code.
 +
* Demo SelectionSort
  
 
== Thursday (9/20/12) ==
 
== Thursday (9/20/12) ==

Revision as of 11:00, 26 September 2012

Wednesday (9/26/12)

Warmup:


Agenda:

  • Add a (s)ort option to your AddressBook
    • In order to compare Strings:
if (str1.compareTo(str2) < 0)
{
  System.out.println(str1 + " goes before " + str2);
}
  • So inside your AddressBook, you'd have something like this:
if (myContacts[i].getLastName().compareTo(myContacts[j].getLastName()) < 0)

Monday (9/24/12)

  • Introduction to Selection Sort
  1. Find the smallest element
  2. Move to the front of the array (swap with front)
  3. Repeat Steps 1&2, but ignoring the sorted front

Thursday (9/20/12)

Agenda:

Friday - Tuesday (9/14/12 - 9/18/12)

Warmup:

Agenda:

Homework:

Wednesday (9/12/12)

Agenda:

  • Demo Media:CombatSimulation.java
  • Review Arrays
  • Array practice activities. Create a new Java class named ArrayPractice
    1. Create an array of 10 Strings (Use names of students in the room). Using a for loop, print out all the Strings in the array.
    2. Create an array of 10 integers (make a bunch of numbers up). Using a for loop and an if statement, print print out only numbers greater than 10.
    3. Create an array of 10 integers. Using a for loop, calculate the sum and average.
    4. Demo ArrayPractice
  • AddressBook beginning walk-through
  • AddressBook class lab assignment

Monday (9/10/12)

Warmup:

  1. Bring up NetBeans
  2. Import your summer assignment
  3. Demo using Media:CombatSimulation.java

Agenda:

Thursday (9/6/12)

Tuesday (9/4/12)

  • Introductions
  • Name cards
  • Lab setup/config
    • Login username is your first initial and lastname (e.g. pbui)
    • Your password is your student ID number
    • Go to Apple (upper left) -> System Preferences -> Accounts -> Change Password
    • Acceptable-use policies apply in this lab!
  • Complete the Student Surveys