By doing it the way you are doing it makes it difficult to understand what each if statement is handling. It could also cause one of your if statements to become 'nested' in another, meaning that it will never be used for comparison (because if it gets in there in the first place, the comparison criteria won't match the second 'if' anyway).
The bracers are there so that you can encapsulate the functionality you wish to execute, or if you are struggling to understand that, they are there to ensure that the result of the code inside the for loop is executed in isolation. Make sure that your if statement handles ONLY what you want it to handle, this can be done by using bracers, and breaking your if statements up correctly as I've shown you above...
The rest of your code is fine (besides the random while loop), but remember that you also want to record each category when it enters the if statement that it is relevant to! (hint: increment the category integer by 1 every time it enters the if statement it belongs to!)
Then you can use your category values outside your for loop, and display how many members are inside each category!
That's about all i can offer you without giving you the solution myself (which I have been on the brink of doing a few times), so best of luck with finishing your assignment! I hope I've been able to help you with the questions you had!