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);
2
title = idk count = 5 monkey = null
title = hii count = 2 monkey = germaine

Unit 9

Hack 1

class Vehicle {
public String name;
public Vehicle(String name) {
    this.name = name;
}
public static void honk() {
    System.out.println("bugger off the road monkey");
}
public static void main(String[] args) {
    honk();
}

}

class Car extends Vehicle {
public String make;
public String model;
public Car(String name, String make, String model) {
    super(name);
    this.make = make;
    this.model = model;
}
public String CarToString() {
    return(this.name + " is the name of the " + this.make + " " + this.model);
}
public static void main(String[] args) {
    Car babababababooey = new Car("babababbababababooey", "toyota", "camry");
    System.out.println(babababababooey.CarToString());
    honk();
}
}
Car.main(null);
babababbababababooey is the name of the toyota camry
bugger off the road monkey

Hack 2

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);
mwahhahahaha monkey blah8bananannana

Unit 10

public long fibonacci(long monkey) {
    if (monkey<= 1) {
        return monkey;
    } else {
        return fibonacci(monkey-1) + fibonacci(monkey -2);
    }
    }
    fibonacci((long)(9));
34