Amateur C++ programmer needs serious help with a killer task

Task "Sewing Fabric":

Create a class "Skirt" which has variables for model name, material name, lenght and width of the material and percentage of the remnant. The sewing fabric sews 3 different models of skirts. Find out which one of these 3 models needs the biggest quantity of the material and which one has the smallest percentage of the remnant.

I have no clue how to write it.


Here's my not finished try:
http://pastebin.com/B0x7fSY6







(I'm using Visual C++)





I just realized I posted it in the general c++ programming. But I need help so badly.
Last edited on
I think you can use a better representation of your data member.

Write a base class which will include all 5 data members:
model name, material name, length and width of the material and percentage of the remnant
.

As for the types of data members I don't think you should use int for all. As names suggests use string for first two, double for the rest.

You need to write 1 member function for
which one of these 3 models needs the biggest quantity of the material
that calculate this. I am guessing it should contain something like this (length * width)/remnant as comparative quantity.

And also something similar that uses only the remnant part.
Have you attempted to sit down with a pen + paper and work out how you will calculate how much material you've got left?

If not, then I'd suggest you do that first before there's any point in writing your program. You cannot write a program if you don't know what that program is going to do.

Once you've understood the calculation, then you'll have somewhere to start. A good approach to writing a class is first to decide what that class needs to do (e.g. perform a calculation) - that will give you an idea of some of the member-functions your class will need to contain.

What you seem to have done so far is write a class which simply has a bunch of "Get" member functions - such classes are rarely of any use in solving tangible problems; If, on the other hand, you can decide what problem you want your Skirt class to solve, then you're well on your way to creating something useful
Topic archived. No new replies allowed.