School Catalogue - 'class SchoolCatalog'

Since I was feeling confident I wanted to try out the extra tasks at the end of the School Catalogue project.
One of them is:

Create a class called SchoolCatalog that holds a collection of schools. Create an instance of SchoolCatalog for primary, middle, and high schools.

But I have no idea how to even start this task!

I don’t even know why the school catalog has to be a class. What I think of by a catalog is that when I call it I get a nice list with all the instances I have created thus far. But I can’t call on a class can I? A class is only to create new instances, instances I can call afterwards.

Ahhh! Help?

I’m gonna abstract a bit to just help you understand the problem

Pseudocode example

Create a class called KarateSkill that holds the names of students

Class KarateSkill
    arr [] //this is an array to hold the student names

Now we have a class that can hold an array of students

Create an instance for Green Belts, Blue Belts, and Black Belts

KarateSkill blackBelts;
KarateSkill blueBelts;
KarateSkill greenBelts;

Boom now we have three instances of our KarateSkills class
One for students of each desired belts
Now I can add methods to my KarateSkills class to do things like add and remove students
Using those methods would look like this


Whenever I don’t understand the instructions of a project or assignment, I re-read the entire problem first. Then build an outline, break it down into very small steps and plan/build one very small step at a time. Eventually things come together. Test things after you’ve coded a small amount and often.

Once you start to get the hang of that, you can think bigger picture things before coding like
“What data structure is best for my KarateSkills class?”
It probably would not be an array in this case. Due to frequent resizing.

You’re on the right track, keep at it!


Thank you for your long answer! :slight_smile:

But then you still have to manually add or remove the schools right? It doesn’t make one automatically when I create a new instance.

I re-read the assignment and indeed it says it the way you say it. I just made it more complicated in my head. :wink: I do wonder if it is possible to let something like that happen automatically? It probably would, but I have no idea how. I guess I’ll learn that later on…

1 Like

thank you for clear and kind explanation for beginners!
I stimulated by your advice. and will keep going

by the way, I have one question, i think, that is not quite related to this challenge though,
why due to frequent resizing, it would not be an array?

thank you!