Question: PLEASE IN JAVA Assume that we have a class Ball. The constructor looks like this: public Ball(int size). a. Write a for-loop that creates 10

PLEASE IN JAVA

PLEASE IN JAVA Assume that we have a class Ball. The constructorlooks like this: public Ball(int size). a. Write a for-loop that creates

Assume that we have a class Ball. The constructor looks like this: public Ball(int size). a. Write a for-loop that creates 10 objects of this class. The smallest ball shall have size = 40 and the largest ball shall have size = 49. b. The objects shall be stored in an array list called balls. Assume that the Ball class has a method called 'public boolean hasExploded()'. c. Write a for-loop that goes through your "balls' list and checks if any ball has exploded. In that case, it shall print something like: "Ball number 3 has exploded". Note that you do not need to include the Ball class in your

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!