Results 1 to 4 of 4
  1. #1
    loux2015 is offline Member
    Join Date
    Sep 2013
    Rep Power

    Default Body Systems Class

    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.

    Java Code:
    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()
    return systemInfo();
    //Method #3 (Service)

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Rep Power

    Default Re: Body Systems Class

    Not too sure on the terminology used, but I'm going to hazard a guess that a service method is one that does something in relation to an instance of the class.

    So an "accelerate" method in a Car class will cause a Car object on which it is called to go faster, possibly altering other variables such as fuel consumption or whatever.

    You need to think of something an instance of your BodySystem would do.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Rep Power

    Default Re: Body Systems Class

    Body Systems Class

    Duplicate post

  4. #4
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Rep Power

    Default Re: Body Systems Class

    Just an FYI, people in forums don't like to find duplicate posts - exhaust one resource before mass copy/pasting your question all over the internet. Otherwise, there is a lot of wasted effort and people wont be likely to help you again in the future.

Similar Threads

  1. Connecting two java systems on same JVM
    By ishfady in forum Networking
    Replies: 0
    Last Post: 07-27-2013, 10:39 PM
  2. Help for numbering systems (binary)
    By jimmy91 in forum New To Java
    Replies: 2
    Last Post: 06-12-2011, 02:25 PM
  3. HSQLDB and 64bits Systems
    By orion_mcl in forum New To Java
    Replies: 1
    Last Post: 03-30-2011, 08:21 AM
  4. linear systems of equations
    By tyang in forum New To Java
    Replies: 2
    Last Post: 03-24-2010, 03:13 PM
  5. wikis systems
    By Peter in forum Advanced Java
    Replies: 2
    Last Post: 07-04-2007, 07:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts