Basic Shapes | |
Assigned: Weds Apr 30, 2003 | Due: Wed May 14, 2003 |
Grade: 80 points |
The "new" concepts covered in this program are:
|
Complete "Programming Challenge" 8 on
page 906 of our textbook, that I like to call
"BasicShapes"... plus a couple tiny additions:
The user interface to your program is very simple:
BTW, there is an error in the specification of the problem in the book. Can you find it? Reading BasicShape FilesSo, you're going to read in a file of BasicShapes. You can define your own file format and function(s), within the following guidelines:
Once you have a vector full of BasicShapes, then you should report the description and area of each. Implementation Um, do the vector, reading of BasicShapes, and reporting of your BasicShapes in main(). My solution has read and report functions in my main C++ file, and I pass around vectors of BasicShapes.
|
Your program will be graded on three areas: design, quality, and function. Their description and weighting in your grade is given below. 1. Program Design (25%) It is essential to design your program before pounding it out in front of Visual C++. The design for this program requires:
You should include all the class interface files in your main() and be able to compile, but not build (or link) because your class member functions are not yet written. 2. Program quality (25%) I'm working on a more comprehensive style guide, but here's what I will be looking for:
3. Program function (50%) If your program doesn't compile or link, your grade for this section will automatically be cut in half and then I'll start from there. Please leave a README file in your prog01 folder with notes you want me to read. Good luck. |
All is well... Since you are defining the specific nature of your BasicShape file, you must create at least 3 files to exercise your program. May 1, 2003 When using the vector for this assignment, create a vector of BasicShape pointers, not the actual objects. Since BasicShape is an abstract data class, it can't be used in a vector, and the compiler will go berzerk if you try (it's fun). So, this is probably what most people will want:
Congrats to Kim Bulmer... winner of Bill's candy as the first to find the error in the specification of the problem in our text. Can you find it? But no more candy... sorry. May 5, 2003 In the virtual function description, that I asked for, you can return a C-string, rather than a C++ string, if you like. May 9, 2003 There is a bug in the Microsoft Visual C++ implementation of the strstream object. The C-string returned by the str member function of strstream is not correct. You need to terminate that C-string with a '\0' character after all your formatting is complete. Here's an example:
BTW, strstream objects are a handy way to implement your description functions for each BasicShape derived class.
|