processes Student records stored in a
simple textfile [student.dat].
StudentRecords adds new student records to the student.dat file in the format
lastName:firstName:studentID:gpa. Clicking Display All Student Records
student.dat; counts total records; creates an array
array the appropriate size; populates the array with Student object instances;
and then sorts results in alphabetical order (far right, below).
- ScreenSaver draws 100 randomly filled
shapes (lines, triangles, spheres). Uses Java 2D with
plus MyLine, MyTriangle,
- Complex is an abstract data type.
The ComplexTest.java driver application instantiates two
Complex objects and then performs calculations using the two objects.
- Morse Code generates
Morse code from an input line of letters a-z and digits 0-9.
- Pig Latin accepts a single word, phrase, or sentence
as input and converts to pig latin using simplified rules.
- Addressbook Manager Application to manage XML-based address book
(AddressBook.xml) file. Includes user interface
for adding, deleting, searching, and editing contacts. Implemented as JavaServer
Pages (JSPs), deployed to Apache Tomcat. More...
- Compound-interest calculator A Web service
calculates compound interest payment amounts and total cost over the life of a loan.
Deployed to Tomcat/AXIS with
web-services deployment descriptor file.
Generated WSDL after deployment.
Simple console-based client obtains response
from service as shown below.
- ContactReportSAX.java uses the SAX parser to parse AddressBook.xml,
search for and display the specified contact.
- A simple Newspaper.xml file based on this XML Schema (newspaper.xsd).
Newspaper.java finds headline by the author whose name is entered at the command line.
- ContactPrintout.java finds a contact in the AddressBook.
Display of AddressBook is filtered by this XML Stylesheet. Two ways
to find contacts:
- ContactPrintout.java finds contacts last name, then first name, and then backs up the tree
to find its
Contact node. Other
complexElements of the XML, such as
and so on (see AddressBook.xsd for details) are then sent to a recursive method for handling.
- ContactReport.java extracts just the information of interest, without the element names, and
prints details in a narrative style.
- The XML Schema, XML document, and
XSLT stylesheet for an AddressBook. Uses XPath expressions to find
only certain nodes.
- DTD alternatives to the XML Schema for defining the structure for the AddressBook:
Legacy (2004) Java console applications
Find words in a text file (2020)
console application expands on the Google-provided Java
findNeedles() method. My Python implementation lets users
specify from 1 to 5 different words to search for in the text file they
choose. The application searches the text for the words, keeps track
of how many of each word are found, and displays the results in the console
as shown in this screenshot:
NLP (natural language processing) code samples
Last updated 18 June 2021