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

Recent news items :

  1. Exemptions from final exam

    Anyone who has earned all 900 possible points so far can afford to get zero points on the final and would still get an A (not an A-) in the course. Such people can therefore afford not to show up for the final.

    Extending this exemption a bit further, we will assume that anyone who has earned 875 or more points so far would easily get 25 points or more on the final and hence get an A for the course. Such people can therefore also afford not to take the final and still get an A.

    Posted: Wednesday, April 30, 2003.

  1. A sample final exam is posted. Also solutions.

    Posted: Friday, April 25, 2003.

 

Assignment 1: “MovingObjects”

Handed out: Monday, January 13, 2003

Due: Friday, February 7, 11PM

 


Previous page | Next page | Schedule and syllabus | Home Page | Bulletin Board | Current notes | Assad's Page | Programs | Table of contents | News archive | Dora

Description

Let the user choose the initial location and velocity of a physical object. Then compute and print its trajectory. This takes place in 2-D with x and y coordinates ranging from -1000 to +1000. Let the user repeat this as often as he or she likes.

Details

The user has two menu options, t to throw an object, and q to quit.

After choosing to throw an object the user types in four integers which are the initial (x,y) location and the initial (dx, dy) velocity of the thrown object.

Your program then prints the object at a series of locations until it gets outside the -1000 to +1000 range or after 1000 stesp, whichever comes first. “Printing the object at a location”, e.g., at (x,y)=(54,-892), is done by outputting the following lines to cout:

drawCircle
54
-892
50
show
The reason for this specific format is that it will let us draw pictures in Assignment 2. The three numbers following the drawCircle specify the x-y location and the diameter of a circle that is being put on the screen.

When the user types an invalid menu choice your program needs to output a list of the (two) valid choices.

Bring questions to class

There are a number of issues about this assignment that may need further discussion such as the specification of color in the above output, the possible use of random numbers in the computation of the trajectories, the use of a suitable “Makefile”, a way to draw pictures on the screen (not required for this assignment), and others. Bring any questions to class.

Files to submit

You need to submit three files:

  1. main.cxx, containing the main program,
  2. MovingObject.h, which is a header file for a suitable class, and
  3. MovingObject.cxx, which is the implementation file for that class.

How to submit those files will be discussed in recitation.

Challenge

Use color and randomness to create visually interesting patterns. Demo your program in class.

Grading guidelines (added later)

        Compiles without errors:  10
Reasonable and consistent style:  10
          Objects move properly:  40
            Output as required*:  40
____________________________________

                          Total: 100

*either as text or piped into drawing program
 


© Karl Winklmann               7:10 PM, Friday, May 2, 2003