Yvonne V. Richardson
  • Home
  • Portfolio
    • Project Management
    • Presentations and Lectures
    • Code Samples >
      • Android Java Resume Application
      • Student-Oriented Code Samples
    • Graphics and Gaming >
      • Making Believable Graphics
      • Little Red Riding Hood Video Game
    • Documentation
  • Web Development
    • Survey of 3-D Game Development
    • Gardeners Planting System
  • Educational Technology
    • Online Education
    • Online Shared Meeting Space
    • Presentation: The Unit Circle
    • Technical ToolBox
    • Mathematics 2 >
      • Math 2 Goals and Objectives
      • Math 2 Course Schedule
      • Math 2 Scoring Rubrics
      • Math 2 Blog
      • Math 2.4 Probability >
        • Math 2.4 Objective A
        • Math 2.4 Objective C
      • Math 2.4 Evaluation
      • Math 2 Thanks You
      • Contact Us
    • Productivity Tools
  • Colleges
  • Links
  • Contact Us
  • New Page

STUDENT-ORIENTED CODE SAMPLES

Teaching samples are usually not the best code. because they are designed to illustrate one point based on the students' current knowledge.  For every snippet posted on a site, a better implementation is in the next chapter, in the next book, or on the next Web page.   In fact, the best code samples on the Internet have been authored by developers to illustrate how to use modules within an API or SDK.  Some of my favorites are included in the Links page.

The CPP Triangle Class

The triangle class, Triangle.cpp, contains a main paragraph that sends the lengths of the sides of a triangle to a function. The function validates that the 3 lengths describe a triangle, and indicates what kind of triangle it is. In the next program, students update this robust code sample to move the driver paragraph into a separate module.

Two-Dimensional Arrays in Java

araymax2.java
File Size: 16 kb
File Type: java
Download File

This program is a rudimentary exploration of 2-dimensional arrays.  It also introduces the concept of multiple windows, which is common for Java programs.  It requires a class named DrawingPanel.java, which can be downloaded from the site named http://www.buildingjavaprograms.com/supplements.shtml. The site accompanies the textbook "Building Java Programs", which is the introductory programming textbook  at UW Seattle.

After the students explore jFrame and jPanel objects, the ArayMax2 program can be written to extend those classes for a sleeker look.

2D Graphical Arrays in Java

framemax.zip
File Size: 8 kb
File Type: zip
Download File

This program explores multiple windows for Java programs; it was intended to be an extension of the araymax program, but the architecture imposed by the Java Virtual Machine meant a complete rewrite.   The new program uses JFrame and JPanel objects to draw shapes in a 2-dimensional array on a screen.
The rewrite no longer requires the DrawPanel object; instead, each shape that can be drawn on the screen is its own class, and it coordinates with the JPanel object extension.

Some presentations contain images that were included with purchased software.
 
Copyright 2012, 2018 Yvonne V. Richardson