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


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
Get step-by-step solutions from verified subject matter experts
