Common Computer Science References
At the end of this lesson, you will be able to:
understand and use methods and fields in a class
property members
read "Using OOP", Chapter 8, Computer Based Problem Solving
read "Methods" & "Fields"
go over Bicycle Class example:
Bicycle Example - TypeScript
Bicycle Example - Java
continue to re-create the MrCoxallStack from last time:
add an isEmpty() getter
it returns a boolean "true" if it is empty
add a size() getter
it returns an integer value of the number of elements in the stack
now make sure your program & class are crash proof
if you ask stack to pop and it has no values, does it error?
make your MrCoxallStack can not die when anything happens to it
there are several things it could do
if the stack is empty, should you be able to show it?
if it is empty, what happens if you "pop()" something?
what should you get back?
anything else you can think of that will make your class "bullet proof" so that you will never get a runtime error
do the above in a second language