Question: Using System. ThreadingSee the name an able in the object with the name you were passed. Set the time variable to your Random Object's Next

Using System. ThreadingSee the name an able in the object with the name you were passed. Set the time variable to your Random Object's Next(5000) Create a method Run() with no parameters Print out "My name is X I am going to sleep for Yms" X should be the objects name, Y should be the time you randomly chose. Call Thread.Sleep(time);Print out "My name is X, I am awake, feed me!!!"You will need to wrap the contents of your run method in a try/catch block, catching Thread Interrupted Exception. In your main class's main method, do the following: Create 5 babies as follows: Baby bl = new Baby("Noah"); Repeat this for b2, b3, b4, b5. They should be named Noah, Olivia, Liam, Emma, Amelia. Create 5 threads as follows: Thread t1= new Thread(b1.Run); Repeat this for t2, t3, t4 and t5. Start all 5 babies with a statement like "tI .Start;"Sample Output:My name is Noah and I am going to sleep for 3398ms My name is Olivia and I am going to sleep for 1687ms My name is Amelia and I am going to sleep for 448ms My name is Emma and I am going to sleep for 4792ms My name is Liam and I am going to sleep for 2671ms My name is Amelia and I'm awake, feed me!!!My name is Olivia and I'm awake, feed me!!!My name is Liam and I'm awake, feed me!!!My name 18 Moan and I'm awake, teed me

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 Programming Questions!