Toyota Nation Forum banner

1 - 8 of 8 Posts

·
Mighty Flying Family Sedn
Camry
Joined
·
510 Posts
Discussion Starter #1
i got some HW that i can't fig out... any help?

this is what i'm supposed to do.

Build off HW #5 by creating a shape vector. After you create your shapes and enter any necessary data, put all the shape into the vector. Use a for loop to run through the vector and show each shape's area and perimeter. Email me any questions, problems, or concerns.
 

·
not actual size
Camry
Joined
·
1,899 Posts
The key to programming assignments is determining what the prof wants you to demonstrate that you know. It sounds like in this instance it is your knowledge of vectors or the implementation of vectors that you did in #5, since writing for loops is trivial, as is determining perimeter, area, and everything else.

Are your vectors multidimensional arrays or something? The problem with my understanding your problem is Arrays are referred to as vectors, but one can also create vector classes (via linked lists, hashing mechanisms, etc). Giving you assistance in understanding the problem is hinged on understanding what #5 is, as well as if there are any other things thrown into this assignment.



Happy birthday, btw :)
 

·
Mighty Flying Family Sedn
Camry
Joined
·
510 Posts
Discussion Starter #5
ah... well i did get #5 here is what i was supposed to do.

Create an object-oriented program, with one class per header file, to do the following:

• The program will use inheritance to create actual shapes from a virtual (abstract) shape class. The shape class should have an area and a perimeter. There should be 2 get functions (getArea, getPerimeter) and two calculate functions (calcArea, calcPerimeter). The calculate functions should be pure virtual (=0;) so that you remember to code them in any children classes.
• You need to code the following classes using inheritance: circle, square, and rectangle. The data members should only contain as few members as possible. One for circle (radius), one for square, and two for rectangle. You will need to add 1 or 2 set functions to set the data for each object. The set functions should be interactive (ex. ask the user what the radius is). You will also need a print function in each class (see example below). Make sure it has the same name in each class.

The main only has object creations and function calls. The main will create one object of each “real” shape. First ask the user for data for all the shapes. Then show the perimeter and area for each shape. Ex. “The area of the circle is 7, and the perimeter is 5. The area of the square is…” Also output to a file.

You should hand in 4 header files with class definitions and function definitions, one main file, and the output file, for a total of 6 files.


all i wasn't sure of was if all the calls were in the main.... we're using inheritance and ton's of header files.... eventually i guess i'll fig. it out... thanks for all you help guys!!~

Much appreciated.:thumbup:
 

·
Mighty Flying Family Sedn
Camry
Joined
·
510 Posts
Discussion Starter #7
it's required as part of my computer information systems BBA

overall i learn more of a business perspective through computers then the tech babble.
 

·
Registered
Joined
·
29 Posts
Mighty~Mart said:
all i wasn't sure of was if all the calls were in the main....
Instruction says:
The main only has object creations and function calls. The main will create one object of each “real” shape. First ask the user for data for all the shapes. Then show the perimeter and area for each shape.
Mighty~Mart said:
we're using inheritance and ton's of header files....
Instruction says:
You should hand in 4 header files with class definitions and function definitions
Didn't you answer your own questions? :confused:
 
1 - 8 of 8 Posts
Top