Friday, November 20, 2009

Name Java. easy


code:

public class Name {

public static void main(String [] args) {
System.out.println(Name.line());
}

public static String line() {
String name = "This is my name";
return name;
}

}

Thursday, November 19, 2009

ICSP - Euler Project 1 in Java

QUESTION:
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9
The sum of these multiples is 23.
Find the sum of all the multiples of 3 or 5 below 1000.


ANSWER:

//Written by Shane Conroy
public class ProjectEuler1
//Ok, so first we create 3 Variables
//MaxInteger states the number you are getting multiples up to
//numberOne states the first number you are getting multiples of
//numberTwo states the second number you are getting multiples of
//the word FINAL is used so that the variables cannot be changed

public static final int maxInteger=1000;
public static final int numberOne=3;
public static final int numberTwo=5;

//void is here because the 'main' line does not return any values
public static void main(String[] args) {
System.out.println("Number of multiples of "+numberOne+" and "+numberTwo+" below "+maxInteger+" is: "+ProjectEuler1.solve());
}

public static int solve() {
int total=0;
for (int i=1; i
if (i%numberOne==0||i%numberTwo==0) {
// Do two statements parallel. Makes sure 15 is not repeated because 3*5=15.
// Gets modulus (remainder) of each and if they have no remainder then add number to total
total= total+i;
}
}

return total;
}
}

Sunday, November 9, 2008

Killary videos

Here's the killary trip videos. :-)

video 1
Rolling in the bog -


Video 2
Ms Killary Dance Off -


Enjoy!!

Hillwalk Photos!!

Hillwalk in djouce mountain. :-)

Djouce Hillwalk

(i put them in the sidebar too so you can see them there. :-) )

Welcome to my blog!

Hey everyone! My name’s Shane Conroy and I've just set up this blog. I go to East Glendalough School and its the best year ever!!! I’m in fourth year at the moment, and all’s going gooooood. :-D I just hope that we’re still allowed go on our tours with the new budget and all. Anyway, will write as soon as I can think of anything. :-P