Units 6-10 Review + Vocab List
Points
Unit | Score | Grading | Comments |
---|---|---|---|
Unit 6 | 0.9/1 | Link | Met all the requirements, showed participation |
Unit 7 | 0.97/1 | Link | Hacks are done with key learnings but quizizz scored 90% |
Unit 8 | 1/1 | Link | N/A |
Unit 9 | Student Lesson Presentation | Link | Started by rotating through dialog on Cars. Sahil shared Car class. Talked about super keyword and had example to show constructor calling super and then assigning custom attribute. Hack was done immediately with bottle/water bottle. Rohit spoke of @Override examples all with println statements. Nathan spoke on super and calling horn method. Kurtis talked about inheritance hierarchy. Nathan spoke again about defining methods with different amount of parameters. Sahil introduced another hack. The activity hacks are well formed and seem well thought out for short examples in classroom. Ritvik finished with the Object superclass and toString method. - Mortensen |
Unit 10 | 0.95/1 | Link | missed one MC question + good implementation of recursion in code |
TOTAL SCORE | 3.82/4 |
Unit 6: Arrays
- array is a type of data structure which contains a collection of data
- Making Arrays: using constructors or using pre-initialized arrays Access elements through arrayName[index]
- How to declare an array, ex:
int[] array dom = new int [9]; (saying array length) or int[] array dom = {1,2,3,4,5}
String[] candy = {"M&M", "Reeses", "Kisses", "Drops"};
for (int i = 0; i < candy.length; i++) {
System.out.println(candy[i]);
}
public class ArrayExample {
public static void main(String[] args) {
int[] numbers = {1,2,3,4,5};
int index = 0;
while (index < numbers.length) {
System.out.println(numbers[index]);
index++;
}
}
}
ArrayExample.main(null);
Unit 7 Array List
Methods to know:
- size(): # of elements in the list
- add(obj): adds an element at the end
- add(index, object): adds element at specific index
- remove(index): removes element from specific index
- set(index, object): replaces element at index with new object
- get(index): returns element at inde
Unit 8
- Array: a data structure used to implement a collection (list) of primitive or object reference data
- Element: a single value in the array
- Index: the position of the element in the array (starts from 0)
- Array Length = the number of elements in the array
- public: so can be accessed in any class
- Access and update elements: arrayname[r][c]
Unit 9
- Inheritance, order in which attributes, methods and strings called
- constructor - where attributes are defined
- overriding - subclass or child class can get overridden with another method in subclass
- polymorphism - running multiple things with same name
- super keyword, use superclass in subclass
// O(n) time since it must go through n iterations to calculate factorial
// factorial calculation
public int factorial (int n) {
if (n == 0 || n == 1) {
return 1;
}
return n * factorial(n-1);
}
System.out.println(factorial(4));
System.out.println(factorial(10));