Results 1 to 3 of 3

Thread: Absolutely Lost

  1. #1
    Lehane_9 is offline Member
    Join Date
    Dec 2007
    Posts
    6
    Rep Power
    0

    Default Absolutely Lost

    xzczczczczczczczczcxcz
    Last edited by Lehane_9; 12-04-2007 at 12:50 PM.

  2. #2
    ShoeNinja's Avatar
    ShoeNinja is offline Senior Member
    Join Date
    Oct 2007
    Posts
    124
    Rep Power
    0

    Default

    Java Code:
    public class Shapes
    {
       //I'm guessing these are ints since they are described as coordinates.
       int a,b; 
    
          public Shapes(int a, int b){
             this.a = a;
             this.b = b;
          }
    
          public int getA()
          {
             return a;
          }
    
          public int getB()
          {
             return b;
          }
    
          public void setA(int a)
          {
             this.a = a;
          }
    
          public void setB(int b)
          {
             this.b = b;
          }
          
          public void toPrinter(){
             System.out.println("[" + a + "," + b + "]");
          }
    }
    
    
    
    public class Orange extends Shapes
    {
       //Assuming these are ints.
       double radius;
       
       public Orange(int a, int b, double r){
          super(a,b);
          this.radius = r;
       }
       
       public void toPrinter(){
          System.out.println("[" + this.a + "," + this.b + "]" + "Radius: " + this.radius);
       }
       
       //this return type may need to be changed if coordinates or radius change
       public double getArea(){
          return 3.14 * radius * radius;
       }
       
       public static void main(String[] args){
          Orange blag = new Orange(3,4,1);
          blag.toPrinter();
          System.out.println(blag.getArea());
       }
    }

  3. #3
    Lehane_9 is offline Member
    Join Date
    Dec 2007
    Posts
    6
    Rep Power
    0

    Default Thank you

    xczzzzzzzzzzxcz
    Last edited by Lehane_9; 12-04-2007 at 12:50 PM.

Similar Threads

  1. need help with program im lost
    By lifeturn in forum JCreator
    Replies: 1
    Last Post: 10-28-2008, 07:09 PM
  2. Lost my javadocs
    By orchid in forum Eclipse
    Replies: 3
    Last Post: 04-30-2008, 09:45 PM
  3. A little lost with for loops and making a design
    By LinxuS in forum New To Java
    Replies: 5
    Last Post: 01-22-2008, 09:05 AM
  4. Help Needed - I'm so lost
    By adlb1300 in forum New To Java
    Replies: 3
    Last Post: 11-14-2007, 01:54 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
  •