Cancode Hacks
Cancode Hacks
// Unit 5 Hacks public class Main { public int count; static int babieskilled = 0; public String title; private String monkey;
public Main(int count, String title) {
this.count = count;
this.title = title;
babieskilled++;
}
public void setMonkey(String newMonkey) {
this.monkey = newMonkey;
}
public String getMonkey() {
return monkey;
}
public String toString1() {
return("title = " + this.title + " count = " + this.count + " monkey = " + this.monkey);
}
public static void main(String[] args) {
Main idk = new Main(5, "idk");
Main idk2 = new Main(2, "hii");
idk2.setMonkey("germaine");
System.out.println(babieskilled);
System.out.println(idk.toString1());
System.out.println(idk2.toString1());
}
}
Main.main(null);
// Unit 9
public class Monkey extends Main {
private String food;
public Monkey(int count, String title, String food) {
super(count, title);
this.food = food;
}
public String toString1() {
return("mwahhahahaha monkey " + this.title + this.count + this.food);
}
public static void main(String[] args) {
Main hahamonkey = new Monkey(8, "blah", "bananannana");
System.out.println(hahamonkey.toString1());
}
}
Monkey.main(null);
// Unit 10
public long fibonacci(long monkey) {
if (monkey<= 1) {
return monkey;
} else {
return fibonacci(monkey-1) + fibonacci(monkey -2);
}
}
fibonacci((long)(9));