CS 455 Assignments
Homeworks
Homework One
Implement the program described in Main and Savitch (MS) p. 27 Self-Test Exercise 6.
Compile and run your
program on either the Wintel (with the VC++ compiler) or the Unix (with g++ compiler)
platform. Then test the program using the boundary values. Turn in your source code and
a runtime session that shows your test results. Due in class Thursday, week 2.
Homework Two
Exercises 2.33, 2.35, and 2.36 in DD (page 136). Due in class Thursday, week 4.
Homework Three
Exercises 3.40, and 3.48 in DD (page 217). Due in class Thursday, week 6.
Homework Four
Due in class Thursday, week 8: Enhance the Direction3D class from the Geometry3D
library to have knowledge of spherical coordinates. Create a constructor that
takes in two angles, azimuth (angle about the Z axis) and elevation (angle
above or below the horizontal in radians (assume that the X-Y plane is horizontal).
These angles are analagous to longitude and
lattitude in geography, except that azimuth should be computed in the range of plus or minus
pi (not as 0 to 360 degrees). Write a test program and show the output with
source code for the modified class and test program.
Homework Five
Due in class Thursday, week 11:
Create accessor functions getAzimuth() and getElevation, and mutator functions
setAzimuth() and setElevation() for the modified class of Homework Four.
Write a test program and show the output with
source code for the class and test program.
Homework Six
Due in class Thursday (week 14): Problem 4.11 on page 272 of Deitel and Deitel.
Programming Projects
Programming Project One
Due on paper in class session of week 5: specify, design, and implement a class for a card
in a deck of swimmer cards for a heat in a swim meet event. Each card will store data
for a swimmer's name (first, middle, last), swimmer's age, the event number, heat number,
event description (e.g. 100m freestyle), and swimmer's best time for the event.
The class should contain methods for setting and retrieving card data items. Write
a demonstration program that exercises these functions.
The project report should have separate sections for specification, design, source code,
and test results.
Programming Project Two
Due on paper in class session of week eight:
Create a Swimmer class that has the following data:
- First name.
- Middle name.
- Last name.
- Age.
- Gender.
- Swim team name.
Create an Event class that has the following data:
- Event number (positive integer).
- Swimmer minimum age (integer).
- Swimmer maximum age (integer).
- Swimmer gender (boolean or integer).
- Event distance (integer).
- Event stroke (character array or string).
Then replace your swimmer-event card class with a new class called "Splash" to use a pointer to a Swimmer object
and a pointer to an Event object. This way a swimmer can
enter sereral events without data being duplicated. Test your design by writing a program to create a
some swimmers who have entered some events in the swim meet.
At this point your swim meet model is nearly complete. It should have some swimmers who participate
in the meet and some events the swimmers compete in. Your test program should exercise all the
member functions of your classes. The project report should have separate sections for specification,
design, source code, and test results.
Programming Project Three
Swim Meet Application
Due on paper in class session of week 11:
Create a swim meet class and work it into your model. I suggest having many events pointed to
by the swim meet, and one swim meet pointed to by each event. Then provide a
menu-driven user interface that provides the following user features:
- Create a new swim meet and give it a location, number of lanes in the pool, date, and name.
- Add events to the meet.
- Add swimmers to the meet. Each swimmer may enter several events.
- Seed the swimmers into heats by sorting on their best times and putting the
faster swimmers in the center lanes of the pool.
- Record event times for the swimmers after each event is swum.
- Given a swimmer's first and last names, report the events the swimmer swam and his times
for each.
- Given an event, give the number of heats that were required to accommodate the swimmers
who entered it.
- For each heat of a given event, list the swimmers by lane number.
Test your application user interface to build a two swim meets with at least 20 swimmers in each.
Make up plausible names, ages, times, etc. for the swimmers (a good swimmer can swim about as fast
as a person can walk). The meets should contain the following events as a minimum:
- Boys age 9 and 10: 50 meter freestyle.
- Boys age 9 and 10: 100 meter freestyle.
- Boys age 10 and 11: 50 meter freestyle.
- Boys age 10 and 11: 100 meter freestyle.
- Boys age 9 and 10: 50 meter backstroke.
- Boys age 9 and 10: 100 meter backstroke.
- Boys age 10 and 11: 50 meter backstroke.
- Boys age 10 and 11: 100 meter backstroke.
- Girls age 9 and 10: 50 meter freestyle.
- Girls age 9 and 10: 100 meter freestyle.
- Girls age 10 and 11: 50 meter freestyle.
- Girls age 10 and 11: 100 meter freestyle.
- Girls age 9 and 10: 50 meter backstroke.
- Girls age 9 and 10: 100 meter backstroke.
- Girls age 10 and 11: 50 meter backstroke.
- Girls age 10 and 11: 100 meter backstroke.
Note: saving data to a file is not required for this project, but if you wish you may
implement that feature. It could make testing the user interface easier. See DD chapter
14 for file I/O if you are interested. In lieu of saving your meet to a file to avoid
having to type all that data everytime you test it, you might create a function
that has the appropriate data hard coded into it and run that function as an option
from the user menu.
Programming Project Four
Archery Physics
Due on paper in class session of week 14:
Consider the act of an archer firing an arrow from his bow. What are the relevant objects
and their attributes?
The bow has a pull weight (force of the bow string at a specific distance of pull)
and maximum pull distance. The arrow
has mass and length (that allows it to be pulled only so far in the bow). One computation
that might come out of this model is arrow velocity when shot from a given bow.
Produce an object model that has classes for the bow, arrow, and flight of the
arrow. Attributes of the flight class include speed, energy,
direction, and momentum.
The maximum distance an arrow may be pulled is the length of the arrow minus eight inches
(to allow for the arrowhead and unpulled bend in the bow). The energy (ft*lb) given to an
arrow is the maximum pull force (lbf) times half the pull distance and is equal to one half
the mass of the arrow (lbm) times the flight velocity (in ft/s) squared.
Arrow momentum is equal to arrow mass times arrow velocity (pound-feet per second, lbm*ft/s).
Masses (lbm) and forces (lbf) are both measured in pounds. Energy is measured in
foot-pounds (ft*lbf). Velocity is measured in feet per second (ft/s). There are 12 inches in a foot.
There are 16 ounces in a pound.
Write a program that instantiates the following objects:
- A 20 pound (at 30 inches) bow with a maximum pull length of 36 inches.
- A 30 pound (at 30 inches) bow with a maximum pull length of 34 inches.
- A 40 pound (at 30 inches) bow with a maximum pull length of 32 inches.
- A 28 inch arrow weighing 1 ounce.
- A 30 inch arrow weighing 1.5 ounces.
- A 32 inch arrow weighing 2.0 ounces.
Assume that the pull force of the bow is linear with pull distance and that the bow
and string are massless.
Each arrow is fired from each bow once. Create a table of arrow flights
giving the arrow, bow, velocity, and momentum for each.
Your report should document your design decisions. What data structures or abstract data types
are you using (arrays, lists, queues, etc.)? Why? Submit files for source code. Runtime
output can be a separate file or included in the report.
Email: Richard dot J dot Wagner at gmail dot com
project.htm, this hand crafted HTML file created August 23, 1999.
Last updated April 14, 2011 by
Rick Wagner. Copyright © 2010, all rights reserved.