Question: Learning Objectives: Create an array of objects. 1. Write a class called Sphere with the following instance variable: private double radius; Write a constructor that
Learning Objectives: Create an array of objects. 1. Write a class called Sphere with the following instance variable: private double radius; Write a constructor that initializes the instance variable. Write an accessor and mutator method for the instance variable. 2. Write a class called TestSphere with a main method. In the main method create an array of Sphere objects with the following statement Sphere[] sArray = new Sphere[3]; 3. Assign a Sphere object to each element of the array 4. Use a loop to display the radius for each of the Sphere objects.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
