Recap:
- reviewed loops
- reviewed homework
- learned how to write methods that can be called in the main method. Here's some examples:
public static void printName (String name) {
System.out.println("Your name is: " + name);
}
private static double cost (int quarters, int dimes, int nickels, int pennies) {
return quarters * 0.25 + dimes * 0.1 + nickels * 0.05 + pennies * 0.01;
}
- learned how to call methods that are in the same class. Some examples:
printName("Ryan");
System.out.println(cost(5, 10, 30, 100));
- learned how to write the Fibonacci sequence using recursion
- learned about some methods that involve Strings, such as substring and length
Today's replit link:
- https://replit.com/@JavaForACSL/10-09-2022#Main.java
Today's homework:
- create a bibonacci sequence; first two terms are 1.1 and 1.1, every next term is the product of the previous two terms
- math terms: b(n) when n > 2 = b(n-1) + b(n-2), b(1) = b(2) = 1.1
- output: 1.1, 1.1, 1.21, 1.331, 1.616...
- using a for loop, output the first 5 bibonacci values by calling a function 5 times (use something similar to print(bibonacci(i))