All hats at Bespoke Hats are made and decorated on premises. The hat maker thread makes exactly NUM_HATS_TO_MAKE Hat instances.

computer science

Description

All hats at Bespoke Hats are made and decorated on premises. The hat maker thread makes exactly NUM_HATS_TO_MAKE Hat instances. They place each one in the first HatStore instance. The decorator thread decorates exactly NUM_HATS_TO_MAKE Hat instances. They get each one from the first HatStore, add either one or two accessories, and place them in the second store for the shopper threads.


The two shopper threads buy the Hat instances. Each hat has one or two accessories that add or detract from its fanciness. One shopper prefers hats with fanciness of 0 or more The other shopper prefers hats with fanciness of 0 or less So between the two, all Hat instances should be bought.


Related Questions in computer science category