Commit 1d45eca2 authored by a-j.towse's avatar a-j.towse

Task 1-10

parent 6ea1f658
......@@ -14,21 +14,44 @@ public class App {
System.out.println("On holiday");
}
}
public static void main(String[] args) throws Exception {
double approxPI = 3.14; //Ex1.5
public static void circumference(int radius ) throws Exception {
double approxPI = 3.14;
double circ = ((radius * 2) * approxPI);
System.out.println(circ);
}
public static String inigoSpeech(int numFingers){
String greetingString = "Hello "; //Ex1.7
String introductionString = "My name is Inigo Montoya "; //Ex1.8
String reminderString = "You killed my father "; //Ex1.9
String threatString = "Prepare to die!"; //Ex1.10
System.out.println(greetingString+introductionString+reminderString+threatString); //Ex1.11
int fingersOnRightHand = 6;
if(fingersOnRightHand == 6){
System.out.println(fingersOnRightHand);
if(numFingers == 6){
return(greetingString+introductionString+reminderString+threatString); //Ex1.11
}
else{
System.out.println("I am searching for the man who killed my father");
return("I am searching for the man who killed my father");
}
}
public static boolean isItALeapYear(int year){
if(((year % 4) == 0) && ((year % 100) !=0)) {
return(true);
}
else if(((year % 4) == 0) && ((year % 100) ==0) && ((year % 400) ==0)){
return(true);
}
else{
return(false);
}
}
public static void main(String[] args) throws Exception {
countDays();
circumference(10);
inigoSpeech(6);
isItALeapYear(2016);
int month = 0;
for(month = 1; month < 14; month++){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment