CSCI 2270 Computer Science 2: Data Structures
Fall 2003
Karl Winklmann

Assignment 2: “MovingObjects3D”

Handed out: Tuesday, September 9, 2003

Due: Friday, September 26, 2003

 


Previous page | Next page | Latest page | Schedule and syllabus | Home Page | Programs | Table of contents | News archive | Dora

Description

Make two additions to Assignment 1: a third dimension and menu choices for taking a picture and displaying it again later.

Details

When you draw the pictures make sure that objects further away appear smaller and are not obscuring objects that are closer.

Use dynamically allocated arrays to store the necessary information. Start out with an array of size 8.

Give the user these menu options:

void showMenu ()
{
    cerr                                         << endl <<
    " t: launch new ball                       " << endl <<
    " r: read input from a file                " << endl <<
    " n: start new picture                     " << endl <<
    " s: store current picture                 " << endl <<
    " d: display the previously stored picture " << endl <<
    " q: exit                                  " << endl;
}
As always, when the user types an invalid menu choice your program needs to output a list of the valid choices.

Assume that when the user wants to read the input from a file, the file contains some number of lines, each containing six integers that specify the initial values of x, y, z, dx, dy, and dz for throwing another ball. Don't do any error checking on that input, other than checking if the file exists.

Files

You need to submit six files: main.cxx, MovingObject.h, MovingObject.cxx, Canvas.h, Canvas.cxx,and a suitable Makefile. The first three are variations of the same files from Assignment 1. The files Canvas.h and Canvas.cxx contain whatever else it takes to do this assignment, most importantly the definition of a class suitable for holding the information that lets you draw the pictures.

Getting Java

For this assignment you need to use the drawing program. If you are not working in the lab and do not have Java installed where you do your work, you can to download it, e.g., from java.sun.com/j2se/1.4/download.html.

Grading guidelines

                    Compiles without errors:  10
            Reasonable and consistent style:  10
                Objects move properly in 3D:  10
             Distant objects appear smaller:  10
  Distant objects don't obscure closer ones:  20
         Using dynamically allocated arrays:  20
Ability to remember and redisplay a picture:  20
________________________________________________

                                      Total: 100
 


© 2003 Karl Winklmann 3:08 PM, Tuesday, December 16, 2003