CS Coursework

Some coding samples from several different CS courses taken between 2004 and 2009, all at College of San Mateo except for CS-277. Computational linguistics coursework (2010-2013) is listed on my Linguistics portal page.

CIS-380 Internet Programming: PHP and MySQL

College of San Mateo. 2009.

In addition to writing many basic scripts for handling PHP (both standalone and in conjunction with MySQL), work for this course also involved more elaborate scripts, such as the craps game and the postcard system.

CIS-112 Internet Programming: AJAX (Asynchronous JavaScript and XML)

College of San Mateo. 2009.

In addition to from-scratch Javascript coding, this course also involved learning how to work with various libraries and APIs from Google, Yahoo!, and so on.

CIS-255 Object-oriented Programming Methods

College of San Mateo. 2005.

  • StudentRecords is an application that processes Student records contained in a simple flat-file [student.dat]. StudentRecords adds each student record to the student.dat file (appends to the end of the file) in the format "lastName:firstName:studentID:gpa". Clicking the Display All Student Records button initiates the process of opening the student.dat file and determining the number of records in the file, and then creating an array of student references of that size; populating the array with Student object instances; and then sorting the array so that the results are in alphabetical order. The application incorporates try-catch exception handling; file i/o; and sorting algorithms [using a QuickSort routine provided by Prof. Green, modified to handle String comparisons rather than integer values]; in a graphical user interface:

    StudentRecords application--Adding a new student record   StudentRecords after clicking Add button   StudentRecords after clicking Display All

    Adding a new student   After clicking the Add button, the field entries are validated, and if everything is okay, the student record is added to the student.dat file; the details of the student record are displayed in the output [above, center]. Clicking the Display All Student Records button outputs all sorted records in the output. [above, right]
  • ScreenSaver application emulates a screensaver by drawing 100 random filled shapes (lines, triangles, spheres). This application uses the Java2D API. Classes from previous projects [the MyShape interface, plus the MyLine, MyTriangle, and MySphere classes] were modified for this project.
  • MyShapeTest applet that demonstrates polymorphism by using an array of superclass references to instantiate subclass objects.
  • ShapeTest applet that instantiates three different arrays of shapes (MyLine, MyTriangle, MyCircle). This project exercises aggregation (also known as "composition", which defines a "has-a" relationship) as well as inheritance ("is-a"). MyLine is the superclass in a simple inheritance hierarchy that includes MyTriangle and MyCircle. MyLine defines two points (using the Point class) and then draws a line between the two points. MyTriangle extends MyLine and adds a new point object to define the third point in the triangle. MyCircle extends MyLine and adds a private member (radius); MyCircle uses only one point from MyLine. The ShapeTest.java class is the driver applet that instantiates three arrays comprising four objects each (MyLine[], MyTriangle[], MyCircle[]) using Math.random to generate the data necessary for the constructors. Colors for the lines are also generated using Math.random().
  • Complex is an abstract data type that represents a complex number and performs basic math operations (add, subtract, multiply, divide) on a complex number. The ComplexTest.java is a driver application that instantiates two Complex objects and then performs calculations using the two objects.
  • Morse Code, a Java application that generates Morse code from a basic input line (just letters a-z and digits 0-9).
  • Sieve of Eratosthenes, an applet that generates all the prime numbers between 2 and 999. Here's the source code listing.
  • Pig Latin application (must compile and run using javac, that is, not an applet). This Java class accepts user input (a single word, a phrase, or a complete sentence) and converts to 'pig latin,' according to simplified rules: 1) words starting with vowels have 'way' added to them; and all other words have their first letter moved to the end, with 'ay' tacked on after that. The PigLatin.java class extends JFrame and uses an anonymous inner class to handle event processing (that is, it listens on the text input component and then invokes the algorithm that converts the words). Key elements of this program: Using StringTokenizer class, passing it a new string of delimiters, calling a separate method (printLatinWord()) that actually performs the conversion. Uses Swing components.
  • Airline Reservation system, an applet that assigns seats in a 10-seat airplane based on user input (a 1 for first class, a 2 for economy). Seats 1-5 are first class, seats 6-10 are economy class. When one or the other class seating is full, offer the user a seat on the alternate class (if a seat is available). If the user doesn't want the seat in the alternative seat class, display a message saying "next flight leaves in 3 hours." Use an array of booleans for the seating chart. Here's the [code listing]. Uses Swing components.

CS-277 XML Processing and Web Services

Notre Dame de Namur University. 2004.

CS-277 was the first class in a now-defunct MA in Computer Science program launched by NDNU in the Fall of 2004. Code samples below include both client and server-side Java (Servlets and JSPs), WSDL, SOAP, and so on (although none of the samples below is running on this website because the service provider makes no Tomcat or other Java server infrastructure available).

Addressbook Manager (Final Project)

Application to manage XML-based address book (AddressBook.xml) file. Developed user interface to add, delete, search, and edit contacts in the AddressBook.xml file. Implemented as JavaServer Pages (JSPs), deployed to Apache Tomcat. For more details...

Code listings:

Other projects
  • Web service that calculates compound interest payment amounts and total cost over the life of a loan, and a simple Java console based client that calls the Web service. This Web service has been deployed on a Tomcat 5 install running Axis (here's the web-services deployment descriptor file for the project). Here's the WSDL that was generated by Axis/Tomcat after deploying to the server.
    Here's a screenshot of the client program with a response from the Web service:Click here for larger screenshot
  • Write a Java program that uses the SAX parser to parse the AddressBook.xml, search for an printout one of the contacts from the AddressBook.xml. This was a real pain, no question, and seemed like more trouble than it was worth. I've a feeling JAXB might have been a better choice, but I'm still trying to get a handle on JAXB.
  • Write a simple Newspaper.xml file based on this XML Schema (newspaper.xsd), and a Java program (Newspaper.java) that gets a headline that matches the name of the author entered at the command line.
  • Write a Java program [ContactPrintout.java] that finds a contact in the AddressBook [note that when you click on the link to display the addressbook.xml, you're getting the results as filtered by the XML Stylesheet] and displays all the data about that contact. Uses the DOM interfaces. This program has two versions:
    • the ContactPrintout.java version is very simple. It finds the contact's last name, then first name, then backs up the tree to find the Contact node for that contact, then sends to a recursive method the other complexElements of the XML (PrimaryInfo, HomeAddress, HomePhones, and so on (see the AddressBook.xsd for details)).
    • ContactReport.java is an alternative approach, which spends a lot of time extracting just the information of interest, without the element names, and prints out in a more 'narrative' style the particulars of the found contact. I think the way I'm working with the data in this latter program would have been better suited to JAXB—I'll try that later, after I've finished creating the SAX version of this program.
  • Create an XML Schema, XML document, and XSLT stylesheet for an AddressBook. Using XPath expressions to find only certain nodes.
  • Create DTDs to be used for XML addressbook. Two primary approaches:

CIS-101 Fundamental Java Programming

Golden Gate University. 2004.

Projects listed are applications (console based) originally created using JDK 1.4.1 but recently (Feb 2014) recompiled with JDK 7. Blackjack and TuitionCalculator are less trivial than the others. Compiled class files available for download.