diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5241a72 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.class \ No newline at end of file diff --git a/runme.sh b/runme.sh new file mode 100755 index 0000000..fb4bd4e --- /dev/null +++ b/runme.sh @@ -0,0 +1,3 @@ +#!/bin/sh +groovyc src/*.groovy +groovy src/Main.groovy --cp src/ \ No newline at end of file diff --git a/src/Main.groovy b/src/Main.groovy index dbd06df..55dcb45 100644 --- a/src/Main.groovy +++ b/src/Main.groovy @@ -1,8 +1,8 @@ -import Square - def name = "Matthew" int programmingPoints = 10 println "Hello ${name}" println "${name} has at least ${programmingPoints} programming points." -println "${programmingPoints} squared is ${Square.square(programmingPoints)}" \ No newline at end of file +println "${programmingPoints} squared is ${Square.square(programmingPoints)}" +println "${programmingPoints} divided by 2 bonus points is ${Division.divide(programmingPoints, 2)}" +println "${programmingPoints} plus 3 bonus points is ${Sum.sum(programmingPoints, 3)}" \ No newline at end of file diff --git a/src/Subtract.groovy b/src/Subtract.groovy new file mode 100644 index 0000000..726e525 --- /dev/null +++ b/src/Subtract.groovy @@ -0,0 +1,3 @@ +static int subtract(int val1, val2) { + val1 - val2 +} \ No newline at end of file diff --git a/src/Sum.groovy b/src/Sum.groovy new file mode 100644 index 0000000..9f22191 --- /dev/null +++ b/src/Sum.groovy @@ -0,0 +1,3 @@ +static int sum(int val1, val2) { + val1 + val2 +} \ No newline at end of file