Write an interface, PointingDevice, containing: an abstract method, getXCoord that returns an int an abstract method, getYCoord that returns an int an abstract method, attentionRequired that returns a boolean an abstract method, setResolution that accepts a double and returns a double

1
Write an interface, PointingDevice, containing: an abstract method, getXCoord that returns an int an abstract method, getYCoord that returns an int an abstract method, attentionRequired that returns a boolean an abstract method, setResolution that accepts a double and returns a double

LANGUAGE: JAVA

CHALLENGE:

Write an interface, PointingDevice, containing:
an abstract method, getXCoord that returns an int
an abstract method, getYCoord that returns an int
an abstract method, attentionRequired that returns a boolean
an abstract method, setResolution that accepts a double and returns a double

SOLUTION:


interface PointingDevice{
   int getXCoord();
   int getYCoord();
   boolean attentionRequired();
   double setResolution(double a);
}

abstract class TestPointingDevice implements PointingDevice{
   public int getXCoord(int x){
      return x;
   }
   
   public int getYCoord(int y){
      return y;
   }

   public boolean attentionRequired(boolean a){
      return a;
   }

   public double setResolution(double a){
      return a;
   }
}

One comment

  • Matt says:

    Funny enough your solution works but this is a simpler way to meet the intent.

    interface PointingDevice{
    abstract int getXCoord();
    abstract int getYCoord();
    abstract boolean attentionRequired();
    abstract double setResolution(double a);
    }

Add comment