## Class Programming Examples and Lecture Notes

Section 3 (Tuesdays & Thursdays 8:00-9:15 AM, Room 101) - Deena Engel

Important Note: All of the PowerPoint Slides listed below are adapted from Prentice Hall's resources for the textbook, Introduction to Java Programming 4E by Y. Daniel Liang and are copyright protected.

December 9, 2003: In-class exercise: using an array and a sentinel

December 4, 2003: In-class exercise: Perfect Numbers; (Optional Material) Applets

• Sorts: Here is a site to explore sorts and compare various algorithms if you wish!

December 2, 2003: In-Class Exercise onHistograms; Linear Search; Bubble Sort; Selection Sort

November 20, 2003: Further work with Arrays InClassExercise, RollDiceWithArrays
Passing arrays to methods: TestPassArray, PassArray2

November 18, 2003: Arrays TestArray

November 13, 2003: Introducing arrays array1, array2, array3, array4, array5

November 4, 2003: More work with Methods FactorialMethods, RaiseToPowerMethod, ScopeDemo, SnakeEyes

October 30, 2003: Terms & Definitions, Maximum, Maximum3Integers, BoxMethods, MathMethods,PassByValue

October 28, 2003: Using Methods: GreenEggsAndHam, Squares1, Squares2, Squares3
Music: Listening to Ravel's Bolero ... for a repeated pattern, but played each time by a different instrument or group of instruments.

• Methods
• Textbook: Chapter 4.1 - 4.8
• Class PowerPoint Lecture, continued: Java_04

October 23, 2003: Multiplication table exercise

October 16, 2003: More work with "for" loops: RaiseToPower, ForStrings1, ForStrings2, ForStrings3, PrettyRug1

October 14, 2003: Using "for" loops: ForLoops1, ForLoops2, ForLoopsGeneral, Nested1, Nested2, Nested3, Factorials
Art: viewing regular patterns in kilims from Iran and Bulgaria from Kilims: A Buyer's Guide by Lee Allane

• for loops
• Textbook: Chapter 3.3.3 - 3.6
• Class PowerPoint Lecture, continued: Java_03_Part2

October 9, 2003: While Loop & Do-While Loop; Continue and Break keywords;
Class Discussion on Program Design: Probability... Rolling a die 1000 times
Class Discussion on Program Analysis: Prime Numbers ... Worksheet & program

October 7, 2003: String_2, String_3, String_4, Flag_1
Class Discussion on Program Design: Carpets
Some improvements you could add here: use "double" data type for the length and width; use a sentinel so the user, in this case perhaps an interior decorator, can keep adding the rooms as s/he walks through the apartment without knowing the number of rooms first.

October 2, 2003: Using accumulators, sentinels, markers: MaxNumber_1, MaxNumber_2, MaxNumber_3,
Introducing strings: String_1
Music: "Fugue For Tinhorns" from Frank Loesser's Guys & Dolls

Art:
Infinite Loops (M. C. Escher: "Handteckning" [Drawing Hands], 1948; lithograph.) and Programming: BadLoop

September 30, 2003: WhileLoopStudy, while_loop_1, while_loop_2, while_loop_3
Use the techniques in while_loop_3 as a debugging tool.

Music: Canon & Gigue in D Major by Johann Pachelbel (1653-1706)

• While loops
• Textbook: Chapter 3.3 - 3.3.2
• Class PowerPoint Lecture: Java_03_Part2

September 25, 2003: random_numbers, random_numbers2, random_dice1, random_dice2, conditional_expressions, conditional_expressions2, concatenation1, concatenation2

• If/Else and Switch statements
• Textbook: Chapter 3.1 - 3.2.5
• Class PowerPoint Lecture: Java_03_Part1

September 16, 2003: pre_post_increment, casting_example, InputDataDemo, even_odd, less_than_five, date_check

September 11, 2003: circle_area, cylinder, circle_area_pi, assignment_operators

September 9, 2003:

• Lab Session worksheet
• Variables, Operators, Input & Output
• Textbook: Chapter 2
• Class PowerPoint Lecture: Java_02

September 2, 2003: welcome, welcome2, and welcome3

• Introduction
• Textbook: Chapter 1
• Class PowerPoint Lecture: Java_01