Hello. I am trying the following modifications to the problem. 1) Make all data members private. 2) Create appropriate get and set methods. 3) Write a test program that creates an array of 10 Planets. 4) Use "for" loops to fill the array, set the number of moons and rings for each planet. However, I seem to be having a few problems getting everything figured out. Could anyone offer any suggestions or ideas to assist me. I seem to be a little confused. Thanks. Here is the original code;
I think you have some significant errors. Why did you change the name of the class? This is often a no-no for instructors. If class Planet originally had instance variables moons and rings, why did you move them to class Planets? The instructions say only to make them private, not to move them. Often get and set method names start get and set and then are followed by the name of the instance property they are encapsulating, capitalizing the starting character. So, the names setMoons and getMoons would be more common than setmoons and getmoons. As far as creating the array is concerned, this planets p = new Planets1; definitely won't compile with the posted class definitions. Also, the brackets surrounding the main method of Planet1 are no good. This example also will not compile. You might want to try to start over, tackling each requirement one at a time, asking questions here to help resolve compiler errors and understanding the concepts of the instructions. Good luck.