From 18eaf1c24c1a74b459dc7cea59f0498031949834 Mon Sep 17 00:00:00 2001 From: Matthew McCullough Date: Sat, 7 May 2011 15:01:44 +0200 Subject: [PATCH 1/5] Ignoring class files --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore 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 From 735794e644faf316c3ebf89bd7facccaab987621 Mon Sep 17 00:00:00 2001 From: Matthew McCullough Date: Sat, 7 May 2011 15:02:11 +0200 Subject: [PATCH 2/5] Added shell script to drive the execution of the app --- runme.sh | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 runme.sh 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 From 09b08e4b4d54a26653c847b88dfa8139826417ae Mon Sep 17 00:00:00 2001 From: Matthew McCullough Date: Sat, 7 May 2011 15:39:39 +0200 Subject: [PATCH 3/5] Added sum function and test call --- src/Main.groovy | 3 ++- src/Sum.groovy | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 src/Sum.groovy diff --git a/src/Main.groovy b/src/Main.groovy index dbd06df..8604816 100644 --- a/src/Main.groovy +++ b/src/Main.groovy @@ -5,4 +5,5 @@ 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} plus 3 bonus points is ${Sum.sum(programmingPoints, 3)}" \ 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 From 3c9306fcc7c41a88a37514a1f4c8d43459eaf966 Mon Sep 17 00:00:00 2001 From: Matthew McCullough Date: Sat, 7 May 2011 15:44:25 +0200 Subject: [PATCH 4/5] Added subtract feture --- src/Main.groovy | 1 + src/Subtract.groovy | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 src/Subtract.groovy diff --git a/src/Main.groovy b/src/Main.groovy index 8604816..11370b0 100644 --- a/src/Main.groovy +++ b/src/Main.groovy @@ -6,4 +6,5 @@ int programmingPoints = 10 println "Hello ${name}" println "${name} has at least ${programmingPoints} programming points." println "${programmingPoints} squared is ${Square.square(programmingPoints)}" +println "${programmingPoints} minus 7 bonus points is ${Subtract.subtract(programmingPoints, 7)}" 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 From e650f374002f860d56ecad63b6fab7387a607642 Mon Sep 17 00:00:00 2001 From: Matthew McCullough Date: Sat, 7 May 2011 19:07:05 +0200 Subject: [PATCH 5/5] Fixed a typo in a tested value of division (comment and actual didn't acgree) --- src/Main.groovy | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Main.groovy b/src/Main.groovy index 11370b0..55dcb45 100644 --- a/src/Main.groovy +++ b/src/Main.groovy @@ -1,10 +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)}" -println "${programmingPoints} minus 7 bonus points is ${Subtract.subtract(programmingPoints, 7)}" +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