Lecture 20, CS 302-6, October 19

  1. Reminders
    1. Exam 1 – October 20

                                                               i.      No 2d arrays on exam

                                                             ii.      Things to bring with you:

1.      Student ID

2.      Pencil(s)

3.      No notes etc

                                                            iii.      25 questions

                                                           iv.      We provide you with operator precedence table, common methods from classes like String, Scanner, etc…

    1. Program 2 – October 28

                                                               i.      Concept of map as a 2d array

1.      cities on each axis, length between is value

                                                             ii.      Cities connected by roads that have a length

                                                            iii.      Want to find shortest path between cities

                                                           iv.      What is a route?  A list of cities.  We can get the length of the route by adding the length of the roads between them.

  1. Review
    1. 2d arrays
  2. Review
    1. Order:

                                                               i.      Arrays

                                                             ii.      Methods

                                                            iii.      Stepwise Refinement, Call Stack Tracing

                                                           iv.      Scanner, random, etc

                                                             v.      Loops

                                                           vi.      Boolean Operators

                                                          vii.      Conditional Statements

                                                        viii.      Data Types

    1. Example 1 – TenCoins.java

                                                               i.       10 Random coins, how many times until we get 10 heads?

                                                             ii.      Should be ~ 2^10

    1. Some clarifications:

                                                               i.      Static vs instance methods

                                                             ii.      Reference variables vs local variables vs parameter variables

                                                            iii.      Clarify – evaluating conditions (practice exam #19)

    1. Example 2 – Parameters.java

                                                               i.      E1 S11 #18

                                                             ii.      Correct answer: A

    1. Example 3 – E1 S11 #21

                                                               i.      Correct answer: B

    1. Example 4 – Truth tables – E1 S11 #20

                                                               i.      Correct answer: C

  1. HW – read 5.8 (for Friday)