This is an assignment given for an AP Computer Science Course, please help! My idea for the class was Body Systems, objects will be body systems. Here are the requirements given:
ou will be designing a class that will demonstrate a variety of the topics discussed in the first three sections of chapter 4, including all of the basic elements of a class and overloading.
Your class must include the following:
-At least 3 pieces of instance data of different types
-At least 2 constructors.
- accessor methods for all of your instance data
- 2 additional service methods
- 1 support methods,
Note: Each item listed above must be labeled with comments. For example, comments for one of the constructors might look like...
// Constructor #1 that uses no parameters
- Include a driver program to demonstrate that your class works as stated. In other words, you must show evidence that all constructors, service methods, and overloaded methods work as designed.
I'm not sure I'm doing my methods correctly, and I'm not really understanding the concept of what a support method is supposed to do in regards to my class. Please help.
public class BodySystems { //Instance Data public String name; //Name of System public String purpose; //Purpose of System public boolean transport; //Y/N Involves transport of material in/out of body public String nameorg; //Name of organs public int organs; //# of Major Organs //Constructor #1 public BodySystems(String name1, int organs1, String nameorg1) // What System, What Organs { name = name1; organs = organs1; nameorg = nameorg1; } //Constructor #2 public BodySystems(String purpose1, boolean transport1) // Purpose, Y/N Involves transport of material in/out of body { purpose = purpose1; transport = transport1; } //Accessor Methods public String get_name() { return name; } public String get_purpose() { return purpose; } public boolean get_transport() { return transport; } public int get_organs() { return organs; } public String get_nameorg() { return nameorg; } //Method #1 (Support) private void whatSystem(int system) { for (system=1; system <= 7; system++) if(system == 1) name = "Skeletal System"; else if (system == 2) name = "Muscular System"; else if (system == 3) name = "Cardiovascular System"; else if (system == 4) name = "Digestive System"; else if (system == 5) name = "Nervous System"; else if (system == 6) name = "Respiratory System"; else if (system == 2) name = "Urinary System"; } //Method #2 (Service) public String systemInfo() { get_name(); get_purpose(); return systemInfo(); } //Method #3 (Service) }