I dont understand this!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ryann18
    New Member
    • Oct 2006
    • 22

    I dont understand this!!

    I was just wondering, my teacher assigned a project for me and told me to "create one cat in SandBox and put all the methods (for example method_1) you need for the excercises in KittyKitty and call then (one at a time) from SandBox" and to turn in only one sandbox and one kittykitty, how if there are 6 assignments??? I dont understand!!!
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Originally posted by ryann18
    I was just wondering, my teacher assigned a project for me and told me to "create one cat in SandBox and put all the methods (for example method_1) you need for the excercises in KittyKitty and call then (one at a time) from SandBox" and to turn in only one sandbox and one kittykitty, how if there are 6 assignments??? I dont understand!!!
    It sounds like your teacher wants you to create one class 'SandBox' that instantiates another class 'Cat,' and call the methods from there.

    Code:
    public class Cat {
    
       // method_1 -> method_6 here
    
    }
    
    public class SandBox {
    
       Cat KittyKitty = new Cat();
    
       System.out.println(KittyKitty.method_1());
    
    }
    Or you could put the method results in variables if they returned something, and manipulate them from there. Does that seem to fit with what your teacher was saying?

    Comment

    • ryann18
      New Member
      • Oct 2006
      • 22

      #3
      Originally posted by sicarie
      It sounds like your teacher wants you to create one class 'SandBox' that instantiates another class 'Cat,' and call the methods from there.

      Code:
      public class Cat {
      
         // method_1 -> method_6 here
      
      }
      
      public class SandBox {
      
         Cat KittyKitty = new Cat();
      
         System.out.println(KittyKitty.method_1());
      
      }
      Or you could put the method results in variables if they returned something, and manipulate them from there. Does that seem to fit with what your teacher was saying?
      Yeah that fits but how would I put only one sandbox on there if I have 6 exercises to plug in??

      Comment

      • r035198x
        MVP
        • Sep 2006
        • 13225

        #4
        Originally posted by ryann18
        Yeah that fits but how would I put only one sandbox on there if I have 6 exercises to plug in??
        What six exercises are you talking about?

        Comment

        • ryann18
          New Member
          • Oct 2006
          • 22

          #5
          Originally posted by r035198x
          What six exercises are you talking about?
          Those six that I had posted before, the ones that you helped me with.

          Comment

          • r035198x
            MVP
            • Sep 2006
            • 13225

            #6
            Originally posted by ryann18
            Those six that I had posted before, the ones that you helped me with.
            Simply put all the methods in the cat class and call them in SandBox as explained by sicarie.

            Comment

            Working...