cs is 4 4 u plate

CS 1112
Spring 2012

Course

Elsewhere










class picture

 Class 42 — April 30, 2012
 Happy Walpurgis night

Download

Agenda

  • Demonstrating course mastery


cookie monsters

 Class 41 — April 27, 2012
 Mmmmmm, cookies.

Download

  • No more

Interested in TA-ing next fall

Agenda

  • Mastering interacting classes


movie poster

 Class 40 — April 25, 2012
 Don't be daffy, you can do it

Download

APIs

Agenda

  • Mastering interacting classes

Redownload

BoidBody implementation


brooklyn

 Class 39 — April 23, 2012
 See the little boid

Download

APIs

Agenda

  • Mastering classes


car

 Class 38 — April 20, 2012
 It's a boid world after all

Download

APIs

Agenda

  • Mastering classes


car

 Class 37 — April 18, 2012
 You are so boidable to me

Download

API

Agenda

  • Mastering classes


calculator

 Class 36 — April 16, 2012
 You are so calculating

Download

API

Agenda

  • Mastering classes

Song gang of three


album cover for helen horal

 Class 35 — April 13, 2012
 I want to teach the world to sing

Download

API

Agenda

  • Mastering classes

Handout — classes

Worksheet


  photo manipulation

 Class 34 — April 11, 2012
 Why not object

Download

Epistle

 

Agenda

  • Photo manipulation
  • Object-oriented chrestomathics

Worksheet

MP3s (for later)


  homer's blowing the dinner horn

 Class 33 — April 9, 2012
  Toot your own horn

Download

Data file

Agenda

  • Photo manipulation

Epistle


  eye pixels

 Class 32 — April 6, 2012
  A ray of sunshine

Download

Epistle

Agenda

  • Getting a handle on two-dimensional arrays

Next class

  • Two-dimensional arrays for representing images

    random colored pixels


  2008 summer olympics

 Class 31 — April 4, 2012
  Beijing judgemental

Download

Agenda

  • Master arrays


  simply fabulous by debbie designs

 Class 30 — April 2, 2012
  Testing 1, 2, Testing 1, 2

Download

Epistles

Agenda

  • Demonstrate prowess

APIs


  1670s fire egine

 Class 29 — March 30, 2012
 Wasted

Agenda

  • Walk in a single line, no talking, no crowding
  • Catch some rays in the Friday afternoon sun


  back side of the moon

 Class 28 — March 28, 2012
 Taken aback

Examples

Recent times

Last time

Next time

Agenda

  • Be comfortable with basics of array manipulation
  • Be comfortable with test 2


  nyc fashion week 2012 collections telescope array

 Class 27 — March 26, 2012
 Collections versus arrays

Examples

Slides

Agenda

  • Gain familiarity with the for loop construct
  • Gain familiarity with the array data structure

Usage

  • ask, question, interrogate

Texting

  • 10q
  • 4649
  • 881

Low down


   riddle histogram

 Class 26 — March 23, 2012
 May the odds be ever in your
 favor!

Examples

Agenda

  • Review

Slides

Three questions

  • Suppose the first line from a method from library UseMe is
    public static int f( int x , String y ) {
    
    How would you invoke the method and prints its result?

  • Consider the following
    boolean y = UseMe.g( "a", "b", 11.12 );
    
    In what file would the method be defined?
    What would be the first line of the method definition?

Library TryIt.java

  • Method name() with specification
    • Return type: void;
    • Parameter list: none;
    • Action: prints out the name of the method (and nothing else).
    • Example invocations

      TryIt.name();
      TryIt.name();

      should produce as output

      name
      name

  • Method longer() with specifcation
    • Return type: String;
    • Parameter list: two String parameters;
    • Action: returns the longer of its two string parameters (if the strings have the same length, it returns the first parameter).
    • Example invocation

      String s = "CS";
      String t = "1112";
      String u = "BS";
      String v = TryIt.longer( s, t );
      String w = TryIt.longer( s, u );
      System.out.println( v );
      System.out.println( w );

      should produce as output

      1112
      CS

  • Method absolute() with specifcation
    • Return type: void;
    • Parameter list: one ArrayList<Double> parameter;
    • Action: modifies the elements of its ArrayList<Double> parameter so that each element becomes its absolute value.
    • Suppose numbers represents an ArrayList<Double> with element values [ -3.0, 1.0, -4.0, 1.0, -5.0, 9.0 ]. Then the following code segment

      TryIt.absolute( numbers );
      System.out.println( numbers );

      should produce as output

      [ 3.0, 1.0, 4.0, 1.0, -5.0, 9.0 ]

  • Method sumOfSquares() with specifcation
    • Return type: double;
    • Parameter list: one ArrayList<Integer> parameter;
    • Requirement does not modifies the elements of its ArrayList<Integer> parameter;
    • Action: returns the sum of the squares of the element values for its list parameter.
    • Suppose numbers represents an ArrayList<Double> with element values [ -3.0, 1.0, -4.0, 1.0, -5.0, 9.0 ]. Then the following code segment

      double sos = TryIt.sumOfSquares( numbers );
      System.out.println( sos );

      should produce as output

      133.0

      because

      (-3)2 + (1)2 + (-4)2 + (1)2 + (-5)2 + (9)2 equals 133.

  • Method generate() with specifcation
    • Return type: ArrayList<Integer>;
    • Parameter list: one Random and two int parameters;
    • Action: returns a new ArrayList<Integer> whose elements are random integer values. The generator of the random values is gotten from its first parameter; the size of the new list is gotten from its second parameter; and the base from which the values are drawn is gotten from its third parameter.
    • Example usage

      Random r1 = new Random( 11 );
      Random r2 = new Random( 12 );
      ArrayList<Integer> a = TryIt.generate( r1, 5,  10 );
      ArrayList<Integer> b = TryIt.generate( r1, 5, 256 );
      System.out.println( a );
      System.out.println( b );

      should produce as output

      [ 8, 8, 1, 5, 3]
      [102, 6, 232, 48, 73]


  Stefaneschi Triptych illustration of the droste effect

 Class 25 — March 21, 2012
 Neither cursing nor rehearsing, but
 recursing

Examples

Recursive definition

Questionaire

Question

  • What is the next number in the sequence 2 3 10 15 26 35 50?

Recursive definitions?


  bar chart histogram

 Class 24 — March 19, 2012
 We need to have a chart to chart talk

Examples

Discussion

Agenda

  • Complete the assignment of project 1
  • Prepare for next class by looking over code examples and a worksheet


  pear tree

 Class 23 — March 16, 2012
 Another pair of "I"'s

Examples

Agenda

  • Continue paired-programming experiment
  • Understand method signatures and overloading


  Point Pleasant post card

 Class 22 — March 14, 2012
 What's the point of it all

Examples

Agenda

  • Understand the can of pass by value parameter passing
  • Instill appreciation for paired programming

What is paired programming

  • A software development problem solving methodology where two people work together in a team.
  • The team uses a single computer during development.
  • One team member acts as a driver; the other member acts as a navigator.
  • The driver member of the team controls the keyboard; the navigator reviews the driver's actions for correctness.
  • The team members frequently switch driver and navigator roles.

What is not paired programming

  • Team members working alone.
  • Team members working apart.
  • Driver and spectator instead of driver and navigator
  • Simultanesous development on different machines.
  • One checking reference material as the other does development.


  Danhauser's 1840 painting or Franz Liszt fantasizing at the piano

 Class 21 — March 12, 2012
 List etudes

Examples

Recipe

Review

Agenda

  • Shake the cobwebs out and show off tans and calluses
  • Understand the cannot of pass by value parameter passing
  • Become better manipulators — with respect to lists

Hmmm


  Seine river

 Class 20 — March 2, 2012
 A method to my saneness

Examples

Source Listing

  • Translater, Windowing, and TranslateIt PDF

Wish

  • Everyone have a good break. Thank the sponsors of your education for me. Tell them I appreciate having you in the class

Agenda

  • Introduce methods with reference parameters


  Stanislavski_Constantin - foreparent of method acting

 Class 19 — February 29, 2012
 Method acting

Examples

Slides

Agenda

  • Become familar with the terminology and mechanics of method definitions and usage.

Tell me more


  data plot

 Class 18 — February 27, 2012
  Score

Examples

Agenda

  • Introduce method fundamentals

Handout examples

 


  you can do it

 Class 17 — February 24, 2012
  Testing, 1, 2, 3, Testing

Download

Agenda

  • Demonstrate prowess

Epistles

cs1112 accomplishments

APIs


  problem solving

 Class 16 — February 22, 2012
  Practace makes perfact

Download

Agenda

  • Take stock of our accomplishemnts



  emperor gum moth

 Class 15 — February 20, 2012
  Like a moth to a light

Examples

Agenda

  • Practice problem solving by completing some useful programs



  giga roller coaster of iowa

 Class 14 — February 17, 2012
  Loop the loop

Examples

Agenda

  • For general problem solving we also need the ability to control how often actions are to be performed (looping). The while statement provides this capability. We will see in later classes, that Java also provides the for statement and do while statement for looping.

LutherVision

Tell me more

Vocabulary

  • loop, iteration, counter variable, index variable, end of data, end of file

Next time




  pondering

 Class 13 — February 15, 2012
  You decide

Examples

 

Test 1

  • Friday February 24

Agenda

  • Some problem solving requires the ability to react. Different conditions need actions to be performed. Java provides several statements that support decision making. We begin by considering the if statement. The if statement uses a logical test expression to determine which of two actions should be performed.

Next time

  • Sections 4.1 – 4.3 — iteration

LutherVision

Tell me more

Vocabulary

  • straight-line, test expression, statement block, local variable


  phone booth

 Class 12 — February 13, 2012
  Call collection

Examples

LutherVision

Next time

  • Sections 3.1 – 3.4 — decision making

Because we care

  • Take the the busy time survey to help me to decide what day to offer the first test.

  • The links column to the left now has a link to tests

Agenda

  • Sometimes when problem solving we need to represent a collection/list of objects. To support such processing Java provides the Collections Framework. The collections framework consists both of a rich set of list representations and an extensive set algorithms for manipulating lists.

  • We explore today to list representations -- the ArrayList and HashMap. They support respectively ordered lists and associative lists.

Post class summary


 
  jig-saw cooperation

 Class 11 — February 10, 2012
  Problem solving

Examples

Agenda

  • Last class did not go as intended. We had technical difficulties and spent a lot of time on material that should have been part of the readings. As a result, we did not get as much time to problem solve as I intended. Let's go for it today.
  • One thing we all need is for everyone to be prepared and present. A third of the class had not done any recent reading and half almost none — we cannot continue this way.
  • A recent paper on the effective teaching of large classes saw a nice increase in student understanding if readings are accompanied by exercises.
  • I created a retroactive on-line exercise sheet for the previous class and another for the next class. Both must be completed by Noon Monday.

Next time

  • Section 2.9 — collections and lists


 
  halloween photo

 Class 10 — February 8, 2012
  Input empowerment

Examples

Data

Agenda

  • Problem solve using multiple data sources — standard input (keyboard), text files, web pages, and strings
  • Use File for representing an element of file system
  • Use URL for representing locations of web resources

Next time

  • Section 2.1 — 2.8 – problem solving

Problem solving


 
  wonder woman comic #1

 Class 9 — February 6, 2012
  String theory

Examples

Agenda

  • Gain familiarity with object manipulation using strings as an exemplar

Next time

  • Section 2.3 — string manipulation

Survey

Just the facts





graphics past winner graphics past winner graphics past winner graphics past winner
graphics past winner graphics past winner graphics past winner
graphics past winner

 Class 8 — February 3, 2012
 Every picture tells a story

Examples

Reading

  • Section 2.2 and 2.4

Agenda

  • Gain familiarity with object manipulation using graphics and random number generation as exemplars

jpc portrait by luther


  grease soundtrack cover

 Class 7 — February 1, 2012
 Tell me more, tell me more

Examples

Reading

  • Section 2.6 – 2.8

Agenda

  • A major course goal is to enable you to develop your own problem solving-specific representations.

  • I believe to accomplish this goal you need background experiences on the mechanics of object construction and manipulation.

  • The way I recommend is that you use objects built from some of the standard resources that are already available. Out of your experiences can come an understanding and appreciation for the object-oriented approach.

  • We will begin with graphical elements for creating windows and drawing shapes

Objectify

Some important APIs' official documentation

Some important APIs' unofficial documentation



  sun

 Class 6 — January 30, 2012
 You're getting warm

Examples

Readings

  • Section 2.1, 2.7 – 2.8

Agenda

  • Understand expression evaluation and formulation

Ponder

  • While the expression 5 < 10 < 12 makes sense mathematically, it is not a legal Java expression. Why is that? Hint: look at the expression while being cognizant of operator precedence

Remember

  • Converting a decimal to an int requires a cast; e.g.,
        int n1 = (int) ( Math.rint( x ) ); 
    int n2 = (int) ( x );

Check out

Wrap up

Each of the programs we considered today offered something for future problem solving


  taylor swift fearless tour

 Class 5 — January 27, 2012
 Fearlessly we march on

Examples

Readings

  • Section 1.9 – 1.10

  • Section 2.1

Agenda

General problem solving requires two-way communication; that is, getting data and sending information back.

Java provides class Scanner as a means for communicating with an input source. Scanner is very flexible with regard to input sources. Files, web pages, and user input are all acceptable.

We will explore today how to create and use Scanners that read user-supplied numerical inputs.

A very basic way of getting input is to directly call for the user to supply it. Java provides programmers with object System.in as the input counterpart to System.out; that is, System.in is the Java representation of a user's keyboard.

When System.in is specified to be the input source for a Scanner, a program can use the Scanner to process user input.

Your need to know



  bunny

 Class 4 — January 25, 2012
 Hopping down the trail to computational  thinking

Examples

Readings

  • Section 1.8

Agenda

Sophisticated problem solving requires the ability to abstract. A very basic part of abstraction is ability to name a value and to manipulate the value through a referencing of its name.

  • Continue our exploration of primitive types.
  • Introduce variables for naming locations in computer memory where values are stored.
  • Use definition statement to specify the name, type, and initial value associated with a variable.
  • Explore variable assignment.
  • Practice program modification.

For inquiring minds


  Hermes typewriter

 Class 3 — January 23, 2012
 Are you my type

Examples

Readings

  • Sections 1.1 – 1.7

Agenda

Last class we handled a very important task in computational problem solving – basic user communication. This class we are going to

  • Expand our communication skills;
  • Introduce the different types of basics values that Java provides (in programming speak they are called the primitive types);
  • Introduce the notion of operator precedence;
  • Develop an appreciation for writing readable programs.

Linkify


  louvre

 Class 2 — January 20, 2012
You'll only pass this way once

Examples

Readings

  • Sections 1.1 – 1.4

Agenda

  • Convince everyone to become a computing major
  • Introduce terminology to which you should become accustomed
    • Class
    • Method
    • Comment 
    • Whitespace
    • Keyword  
    • public
    • class
    • void
    • Statement
    • Semicolon
    • Library
    • System
    • Dot operator
    • System.out
    • println()
    • Literal
    • String[]
    • Identifiers
    • Translation
    • Interpretation



  movie poster

 Class 1 — January 18, 2012
First day of the rest of your life

Agenda


  tom petty album cover

Early January 2012
The waiting is the hardest part

Practicing structured communication

Write an original, thoughtful haiku and electronically upload it using the class submission system by Noon Tuesday January 17 (the day before the start of classes).

In terms of structure a haiku is a three-line poem with the first line being five syllables, the second seven syllables, and the third line being five syllables. A haiku is not expected to rhyme. A haiku is expected to paint an image regarding feelings and experiences.

Your haiku is to be about your class expectations or concerns. The poem should be appropriate for other class members to read. Students who do not complete this assignment on time are subject to dismissal from the class.

Software development

A major activity occurring throughout the semester is developing the ability to program in the Java language. In order for this to happen you need two pieces of software on your personal computer.

SDK

If you are a Windows user, you need to download and install the Java SDK. The SDK is a free download available from Oracle. There are two versions depending whether your laptop is running 32-bit or 64-bit windows. Most recent laptops are 64-bit. If you are unsure the 32-bit version works for all. 

Mac OS X users have the JDK software pre-installed, so nothing needs to be done with regard to the SDK.

DrJava

After taking care of making sure you have a Java JDK installed, you can download and install DrJava.


Readings

A handbook will be available from the bookstore. The handbook will contain an in-progress textbook and the major course examples. Please bring the handbook to every class meeting.