Groovy web console

subscribe to the feed Subscribe
to this
My first Groovy stuff (via #groovywebconsole)
tweet this snippet Tweet

My first Groovy stuff

Published 3 months ago by Ad with tags Ad
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
class Calculator {     
  def x,y;       
  public def addition() 
	return x+y;     

public def substract() 
	return x-y;     

public def multiply() 
return x*y;     

public def division() 
return x/y;     
public void setX(def pX, def pY) 
	x = pX; 
	y = pY;
static void main(String[] args) 
	Calculator calc = new Calculator();        
def a=100;
def b=10;
	println("addition of "+a+" and "+b+" is "+calc.addition());   
	println("subraction of "+a+" and "+b+" is "+calc.substract()); 
println("multiplication of "+a+" and "+b+" is "+calc.multiply()); 
println("division of "+a+" and "+b+" is "+calc.division());