producer and consumer problem by using class