I need some help on this c++ program.

Write a class definition for the following class of objects.

The type of object is a freight package in a box.
For each such object, there are private variables that describe the package. They are length, width, height, and weight. (all of type double)

There are two constructor functions for this class:

*first constructor function: has no arguments. In this case, assign default values of length = 24, width = 12, height = 16, and weight = 20.

*second constructor function: has four arguments: length, width, height, weight.

The class has eight basic accesors and mutator functions. Write only the ones for length and width. End of question: Start your answer with :

class FreightPackage
{


Basically this is an example of what my quiz will be like for C++, and I'm very confused on what to do with. This isn't homework. So any help would be very much appreciated.
night_angel
Asked Sep 06, 2011
I use VB and classes work differently than C++ but I found what looks like a detailed C++ explanation with examples.

http://www.cplusplus.com/doc/tutorial/classes/

If this doesn't work for you, post a comment. I have a kid that does C++ professionally and I'll send it to him.
Rob
Answered Sep 06, 2011
Edited Sep 06, 2011
Thanks Rob. That actually helped me. Ironically my professor decided to go over the question, because a lot of other students had the same problem.
Great. At it's best, learning a programming language is a struggle. I do Vb client side and Perl script server side. Wouldn't try to learn another one. My brain is like a pipe full of ping-pong balls. Add one to one end and one pops out of the other. :-)
Rob Sep 07, 2011
Lol I do a little VB and bash, but C++ is very different from those two so it keeps giving me problems. Alas such is the life of a computer science major.
Other than the syntax, the big difference between VB and C++ is your ability to control the memory in C++. That can be an asset in the hands of someone who knows what they're doing but a big liability in the hands of someone who doesn't.

As bright as you are, I have confidence that you will master it.
Rob Sep 07, 2011
Lol I do a little VB and bash, but C++ is very different from those two so it keeps giving me problems. Alas such is the life of a computer science major. http://methoo.com
shomam
Answered Mar 18, 2012

TIP: If it's not your answer to this question, please click "Leave a Comment" button under the question to communicate with the question owner.

Categories