ECE 538 Assignment 4

Do the following exercises:

  1. Write a Python CGI program that calculates a 3D cross product or calculate the GCD of two integers using HTTP query strings to provide the input information.

  2. Write a program to display the intersection of two line segments, (see the discussion of GM Seed and book software on the class CDROM). Input point coordinates from the command line. Draw the line segments on the screen and show the intersection point (if present)

  3. Write a class that encapsulates the concept of a rectangle. See MFC CRect as an example. The member data should be integers and the rectangles should be aligned with the coordinate axes. Provide suitable insertion and extraction routines (for C++) or string conversion functions (Java and Python). Write a member function to indicate whether an integer point (x, y) is contained within the rectangle. Write member functions to return (a) the bounding rectangle of two rectangle arguments and (b) the intersection rectangle of two rectangle arguments (or null if no intersection exists). Provide member functions to draw rectangles on the screen and use a graphical display to illustrate the bounding rectangle and intersection rectangle with various arguments.

  4. Write a graphical Java application that shows a ball (circle) bouncing off the walls of a containing rectangle. This application hould function either as an application or as a applet.

Your submission should include the usual source-code files, executable programs, and a document reporting your work in general and validation tests in particular.


Maintained by John Loomis, last updated 18 Feb 2008