can anyone tell a program to calculate d number of objects in a program?

can anyone tell a program to calculate d number of objects in a program?

tell a program ... no, not really
write it, yes, that isn't really a problem. but then again, since I don't need one, I suggest you try and start coding for yourself. you don't even provide us with a decent description of your problem, so here I must believe the "we only give help to those who do effort" rule steps in

show us what you've written so far, decently explain the problem and provide us with a list of errors. believe it or not, if you fail your class, we won't miss a nights sleep over it, you might, but hey... if it comes that far, who didn't do the work that had to be done??