kelli at alameda-tech-lab.com
CIS-380 | Fall 2009 | Internet Programming: PHP and MySQL | College of San Mateo
Testing email server side
CIS-112 | Fall 2009 | Internet Programming: AJAX | College of San Mateo
CIS-255 | Spring 2005 | Object-oriented Programming Methods | College of San Mateo
CS-277 | Fall 2004 | XML Processing and Web Services | Notre Dame de Namur University
- 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:
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 appletit 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.
- Final project: An application to manage the AddressBook.xml file. Provide a user interface to add, delete, search, and edit contacts in the AddressBook.xml file. Implemented as JavaServer Pages (JSPs), deployed to Apache Tomcat. [Here's a brief write-up about the project and my implementation.] Code listings include:
- Write a simple 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:
- 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 JAXBI'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:
Still trying to figure out a meaningful way to use the ID-IDREF attributes to establish primary-foreign key relationships, and I think the contact2.dtd does a better job, overall, of modeling the data. [Discovered later on that ID-IDREF is only supported in XML Schema for backward compatibility purposes, and it doesn't seem to be able to support what I was trying to do with it, ie., cross-referencing among various elements. So 'never mind'...]
CIS-101 | Summer 2004 | Fundamental Java Programming | Golden Gate University
All projects are applications (console based) and use JDK 1.4.1. Projects 1 and 2 are comprehensive code samples.
Blackjack.java, the final project, is a console game that emulates the game of "Blackjack" aka "21" in which the objective is to get a hand as close to (or equal to) 21. This Java version of the game accomodates one player against the programmatic dealer. This release of the game doesn't allow "doubling down."
TuitionCalculator.java is a program that adds up tuition and fees based on user input. The entire program is a series of do-while statements that check for valid input, and nested if statements. A flag is set to false at the beginning of each loop and remains false until a valid entry is made and the loop is then exited.
Typesetter.java demonstrates using a method to accept character input and return capital letters.
FoneFun.java exercises the StringTokenizer class in conjunction with methods.