Code Demonstrations

Quiz 1: 10-Jan to 26-Jan 

10-Jan
ReverseStringTest.java   A test method and String reverse(String str) to reverse string elements
CountTest.java   A test method and count(Scanner scanner) to count how many integers there are in the stream of a scanner
17-Jan
RangeTest.java   A test method and String reverse(String str) to reverse string elements
RowSumTest.java   A test method and sum(Scanner scanner) to sum integers in a scanner
24-Jan
CompareSearches.java  

Quiz 2: 29-Jan to 9-Feb

31-Jan and 2-Feb
Bag.java  Abstract  Data type a.k.a multi set that extends Iterable
ArrayBagTest.java  A test for a collection class that uses an array to implement Bag<E> extends Iterable
ArrayBag.java All methods complete on Friday 2-Feb
Feb 2nd
BankAccount.java This has compareTo returning less than means more money
SelectionSorter.java Create n random BankAccounts, sort them, print them
SortAlgorithms.java  A class with one sort algorithm (SelectionSort)
Feb 5th
ArrayBagTest.java The unit test we will use to grade your project. Get it!

Quiz 3: 23-Feb

Feb 9th
ReadFromInputFile.java  Read all characters into a StringBuffer. Now with NO NEW LINES
132.txt  (Changed to Tom Sawyer) Need to copy this text file to your project folder to avoid a FileNotFoundException
Note Instead of a new line "\n", each line has a space concatenated at the end to avoid having new line characters be valid followers. Now the output is on one VERY long line
14-Feb
OurList.java  An interface for a List ADT (smaller than java.util.List)
OurArrayListTest.java  Only one test method for get, insertElementAt, size and another to ensure insertElementAt throws an exception
OurArrayList.java  Compiles, but only has 3 methods implemented: get, size, and insertElemetAt
Feb 16 and 19
LinkedListTest.java
LinkedList.java A class with an inner Node class with get and two versions of addFirst (the older one in comments)
 
21-Feb
Set.java An interface with capacity removed
LinkedSet.java Currently (Wednesday) with add, contains, and part of remove. Will be changed Friday
LinkedSetTest.java (currently with add, contains, and part of remove). Will be changed Friday

Quiz 4: 9-Mar

27-Feb
SymbolChecker.java Scan a java file and report mismatched openers and closers
RunSymbolCheckerGRADING.java  A program that prints errors on these two input files
Test0.java 
Test1.java 
2-March
GenericQueue.java The interface for a FIFO ADT
SlowQueue.java  (fixed after class) One implementation of GenericQueue
SlowQueueTestReverse.java  A program that prints errors on these two input files
Test0.java
Test1.java

Quiz 5: 30-March

7-March
RecursiveMethodsThreeTest.java  factorial, fibonacci and isPalindrome (Rick wrote this after Section Leader lecture)
21-March
RecursiveMethodsFourTest.java the four recursive methods handed out in class, now on line temporarily
10D: addReciprocals: adds 1.0 + 1/2.0 + 1/3.0 + ... 1/n
10G: binarySearch
10J: occurencesOf :  recursively searches a singly linked structure
10H reverse:  reverse array elements
28-March 
Recursion1.iava  Trace a recursive algorithm. This code is from lecture page with num ==2 instead of 1 and now also num == 4 as a bonus.  Trace num == 4 and run it to verify
RangeOfIntsInAnArrayTest.java  Find the range of ints in an array recursively using a helper method and two instance variables

Quiz 6: 13-April

Monday 26-March
BinaryTreeOfStrings.java an inner TreeNode class, hardCodeATree, printInOrder, and size
RunBinaryTreeOfStrings.java with a short main method to send messages to an instance of BinaryTreeOfString.
Monday 26-March
GameTree.java The start of Project 9: Game of 20 Questions
animal.txt. Plain text file with questions and answers to build a game tree
Wednesday 4-April 
GameTreeWithIsValid.java  Changed class name and added isValidGameTree and removeRightMostAnswer
Friday 6-April and Monday, 9-April
BinarySearchTreeTest.java A unit test for the following generic BST collection class.  
BinarySearchTree.java  A generic BST with insert
On Monday, 9-April, add toString, containsRecursively and containsIteratively)

Quiz 7: 27-April

Monday 9-April
OrderedMapTest.java A unit test for the OrderedMap collection class
public class OrderedMap<K extends Comparable<K>, V>
OrderedMap.java A collection class with put, size, and toString
Wednesday 11-April
SingleButtonFrame.java  A GUI that listens to button clicks to print to console
Friday 20-April
ArrayListAlgorithms.java  Demonstrate some of Java's polymorphic algorithms on an ArrayList using these static methods from class Collections : max, min, shuffle, sort, and binarySearch.
Monday 23-April
AllWordsContainingTheSubstring.java  Use JTextField to store many lines. Methods include append and setText  (The Dictionary class was removed, now all words are lower case in an ArrayList)

Wednesday 25-April 
AllWordsContainingTheSubstring2.java  Now with two JPanels and JOptionPane.showMessageDialog(null , String), which shows up if the input string is not found in any word.