Question: Java code please hodify the code as follows: 1. The Baker should bake the pies randomly. Use a random number generator to choose whetherthe next

Java code please

Java code please hodify the code as follows: 1. The Baker should

bake the pies randomly. Use a random number generator to choose whetherthe

hodify the code as follows: 1. The Baker should bake the pies randomly. Use a random number generator to choose whetherthe next pie baked is cherry or apple.After 4 apple pies are made the Baker will only make cherry. Also, after 4 cherry pies are made the Bakerwill only make apple. Your code shouldinclude the logic for this. Besidesthese restrictions the choice of what type of pie to make should be random. 2. Create a CherryEater that eatsonly cherry pies. Create a AppleEaterthat eats only apple pies. Both types ofeaters wait until 2 types of their favorite pie is made and then eat 2 pies ata time after which they wait until 2 more pies are finished. After each eater eats 4 pies they arefinished. 3. You will need two different synchronizationobjects - one for cherry and one for apple, and two different sets of methodsfor adding to and eating pies.Alternatively, you can create two different Data classes - one forcherry and one for apple

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!