The goal of this lesson is to review basic computer science principles and prepare for the upcoming test.
-
Difference between public and private
-
What is the type of a variable and what does it mean?
-
How is data saved?
-
Difference between == and .equals()
-
Scope of variable
-
Difference between public and private methods
-
What is the return type of a variable
-
What happens to data inside a method after execution
-
Usages of 'return'
-
How to write a class
-
What is an object
-
Comparing objects
-
How do methods in a class work?
-
How do variables in a class work?
-
Interfaces/Class heirarchy
- We want our bakery to contain a stack of cakes to sell.
- When you create a new bakery, the stack should be empty
- We want the bakery to be able to "bake a cake" (create a new cake object) (costs some of the profit)
- We want to store profits
- We want to get profits
- We want to be able to sell slices of cake
- We want to be able to tell if there is cake to sell.
- We want the cake interface to be able to tell us how many slices are eaten
- We want the cake interface to let us eat slices (why not a set slices method)?
- We want chocolate cake to implement the interface methods
- We want chocolate cake to store how many slices eaten
- When we create a new chocolate cake, we want it to be sliced a random amount
- In our Demo, we want to ask how many customers should be served.
- Use a for loop to serve all of the customers and print out the profit by the end of the day.
-
Usages
-
Visual Example