private:

GradedActivity *grades[NUM_GRADES];

public:

void setLab(GradedActivity *activity)
    { grades[LAB] = activity; }

Totally confused with this one.

what is "uml" ?

If you mean UML diagram, then get Sparx Enterprise Architect and use its reverse engineering capabilities to convert code to UML.

Member Avatar for ArashVenus

first of all , you need to understand the parts of UML diagrams ,
we have actor , use case , and relationships (for more info search the net)

actors are persons or other softwares/hardwares working with this software

use cases indicate the uses of a program in total , you should ask yourself what does this program do for the actors , then start painting them .

now in order to understand and be able to write a UML diagram you should look into some samples

here take a look => https://www.google.co.uk/search?q=UML+Samples&es_sm=93&source=lnms&tbm=isch&sa=X&ei=sJFvU6z8BsKbPcKdgZAP&ved=0CAgQ_AUoAQ&biw=1680&bih=925

I just need to know how to create a class diagram for that particular class... similar to this:

Did I do it right here?
I've attached my UML diagram. Please let me know if it's right or wrong.

class CourseGrades
{
private:
    // Array of GradedActivity pointers to
    // reference the different types of grades
    GradedActivity *grades[NUM_GRADES];

public:
    // Default constructor
    CourseGrades()
    { for (int i = 0; i < NUM_GRADES; i++)
         grades[i] = NULL;
    }

    // Mutators
    void setLab(GradedActivity *activity)
        { grades[LAB] = activity; }

    void setPassFailExam(PassFailExam *pfexam)
        { grades[PASS_FAIL_EXAM] = pfexam; }


    void setFinalExam(FinalExam *finalExam)
        { grades[FINAL_EXAM] = finalExam; }

    // print function
    void print() const;
};

That looks pretty correct. You do need an enum to define indexes into grades such as LAB, PASS_FAIL_EXAM, FINAL_EXAM, etc. At least it looks like that's what you need.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.