regarding this: "I need to know how to assign weights to the categories and sub categories not only for course?"
Firstly you add the category Maths (Choose -> Items and Categories -> add category button).
Then add the categories Course1 and 2 and then move each assignment inside the sub categories. The layout will be like
Math
- course1
X Math - - quiz
- - homework
- - X course1
- course2- - homework
- - X course1
- - quiz
- - homework
- X course2
- - homework
- X course2
Now if quizes have a different weight from the homeworks, you have to choose in Course1 and 2 (sub-category level) "aggregation: weighted means of grades". This choice will allow you do add weight (by clicking on the edit icon) the quiz and homework.
If Course 1 and Course2 subcategories have the same weight, you should choose in Math (category level) the "aggregation: simple weighted mean of grades".
I hope it help a bit...
anna