Announcements, Homework, Lecture Outlines

Thursday  7-May

Announcements

Grades updated 6:55 pm to include all CSIDs and all projects and project replacements
Copy of grades as of 7-May 
Practice Final Answers
Comprehensive final exam will be in our usual lecture hall (201 Education)
11:00 am to 1:00 pm Wednesday, 13-May, 
Review session: Tuesday 12-May, 5:00 - 6:30 pm in 906 Gould Simpson

 

Wednesday 6-May

Announcements

Comprehensive final exam will be in our usual lecture hall (201 Education)
11:00 am to 1:00 pm Wednesday, 13-May, 
Review session: Tuesday 12-May, 5:00 - 6:30 pm in 906 Gould Simpson
Reminder: Boggle Iteration 1 was due last night at 8:00 pm
You can use 1 or 2 late days by 11:59 pm tonight, but all projects must be in by today.  
Section leaders lab help ceases at 5:00 pm tonight (Wednesday).

Homework

Take the Practice final and check answers  that will be posted here by 3:00 pm, Friday 8-May 

Lecture Outline

Consider your current  grades 
Get your CSID at https://www.cs.arizona.edu/computing/services/csid.html, 
Hand out practice final
Final Exam Review Sheet
Here are links to the other two practice tests and answers
227PracticeTest1Spring09.pdf
PracticeTest1Answers.pdf
227PracticeTest2.pdf
  227PracticeTest2Answers.pdf

 

Monday 6-May

Lecture held in 228 Gould Simpson Computer Lab

Friday 8-May

Lecture held in 228 Gould Simpson Computer Lab

Wednesday 29-April 

Announcements

Project 11: Boggle is now linked
Iteration 1 is required as a solo project (this is about 33% of a weekly project)
Iteration Part 2 is optional  solo (this is about 66% of a weekly project)
This will replace your lowest project score if it is higher
Friday and Monday Lecture will be held in 228 Gould Simpson to work on Boggle

Homework

Begin Boggle, email it to yourself so you can get it in the lab on Friday

Lecture Outline

Turnin these  three  printouts to your section leader
RandomWriterWithPriorityList.java
RandomWriterWithOrderedMap.java
Your most interesting 500 randomly generated characters
Complete Java's Collection Framework  begin at slide 21-19
Iterators
Java's enhanced for loop
Here is an answer to Monday's in-class using Java's collection framework
Introduce the final project: Boggle  (see projects page)

 

 

Monday 27-April 

Announcements

Due Dates for Project 10 OrderedMap<K,V> and the two RandomWriters
Tuesday, 28-April @ 10:00 pm remove and your OrderedMapTest 
At the beginning of lecture Wednesday, 29-April @ 10:00 am, three  printouts
RandomWriterWithPriorityList.java
RandomWriterWithOrderedMap.java
Your most interesting 500 randomly generated characters

Homework

Complete Project 10: OrderedMap/RandomWriters

Lecture Outline

Any questions on current project?
Introduce Java's Collection Framework
In class

 

Friday 24-April 

Announcements

Project 10, Part I has been Webcatted
First part submitted to WebCat only needs OrderedMap<K,V> and OrderedMapTest

Homework

Work on  Project 10: OrderedMap/RandomWriters

Lecture Outline

Any questions on current project?
HashTables: Another data structure with better runtimes than balanced BSTs


Wednesday 22-April 

Announcements

Project 10 Linked

Homework

Work on  Project 10: OrderedMap and Two RandomWriters

Lecture Outline

Consider the remove algorithm when there is a left child
Consider part 2 of Project 10: RandomWriters
RandomWriter.ppt 
RandomWriterWithPriorityList.java is you own design, Recommended:
Use a StringBuilder to hold all chars in the text, 
Only need to read from file once
StringBuilder has an efficient append method (better than String concatenation)
Consider algorithm using an OrderedMap built before any random text output occurs
algorithm is given on Project 10 spec on projects page
In class

 

Monday 20-April 

Announcements

Project 10 Linked (one lecture early again)

Homework

Work on Game of 20 questions

Lecture Outline

The Map ADT and OrderedMap, which is part of the next project
OrderedMap.ppt
Consider part 1 of Project 10: OrderedMap 


Friday 17-April 

Announcements

None

Homework

Work on Game of 20 questions

Lecture Outline

Binary Search Trees

 

Wednesday 15-April 

Announcements

Project 10 Linked: Game of 20 Questions

Homework

Begin next project

Lecture Outline

Lecture today is all about the Game of 20 Questions and Java considerations needed to complete the project
Pay a game of 20 questions
Consider the next project: Game of 20 Questions
Look at the spec (see project page)
Your GameTree class must implement GameOf20Interface
Use and Enum type named Choice

Choice selection = Choice.Yes;

if(selection == Choice.Yes)

System.out.println("user must have selected Yes" );

Read from an input file with Scanner(new File("filename"));
Code demo reading operators and operands to construct an expression tree
Write output to a text file with FileWriter and PrintWriter

 

 

 

 

Monday 13-April 

Announcements

Project 7 RecursionFun does not require a printed handout Wednesday 
Simply submit to Webcat
Obstacle course bonus homework now WebCatted (code coverage on the GUI is ignored for this one--you can get 5/5 even with poor code coverage, so submitting the GUI is okay)

Homework

Read Project 9: Game of 20 Questions (see Projects page
Repeating: Optional  Homework  
By Wednesday 15-April, 9:50 am, complete ObstacleCourse.pdf
This is a 0 through 5 point bonus homework depending on your WebCat problem coverage score

Lecture Outline

Finish ExpressionTree with this methods. Note some of these methods are very relevant for the next project, especially build.

private TreeNode build()

public String infix()    // Return the infix traversal of the data in ExpressionTree

public String postfix()  // Return the postfix traversal of the data in ExpressionTree

public String sideways() // The tree with levels shown as indents in a "sideways" manner  

public int valueOf()     // The value the expression tree evaluates to (integer operands)

 

Friday 10-April 

Announcements

Project 7 RecursionFun will not require a printed handout next Wednesday 
Simply submit to Webcat
Obstacle course bonus homework now WebCatted (code coverage on the GUI is ignored for this one--you can get 5/5 even with poor code coverage, so submitting the GUI is okay)

Homework

Read Chapter 19: Binary Trees
Optional  Homework  
By Wednesday 15-April, 9:50 am, complete ObstacleCourse.pdf
This is a 5 point bonus homework if you get 100% problem coverage on WebCat

Lecture Outline

Introduce Binary Trees
Begin Code demo:  Expression Trees  ExpressionTree.pdf  was attached to today's handout

 

Wednesday 8-April

Announcements

Project 7 RecursionFun does not require a printed handout this time (we'll check your WebCat submisson)

Homework

Complete Project 7: RecursionFun
Now Optional  By Wednesday 15-April, 9:50 am, complete homework ObstacleCourse.pdf
Now not required, 5pt bonus homework if you get 100% problem coverage on WebCat

Lecture Outline

More Recursion: Backtracking
Escape the obstacle course  Tracing the recursive calls.  See ObstacleCourse.pdf


Monday 6-April 

Announcements

Project 7 Linked: RecursionFun

Homework

Before Wednesday's lecture, complete these JavaBat problems
Remember to login first to get credit
 changePi  noX  array6
 array11  array220  allStar
 pairStar  endX  countPairs

Lecture Outline

Guest lecture by Will (while Rick was at ChiliPLoP 2009
Do a couple JavaBats
Sequential Search an array of strings
Divide and Conquer with Recursive Quicksort

 

Friday 3-April 

  Test 2

 

Wednesday 1-April (no kidding)

Announcements

Test 2 Friday 3-April
Test review session: 6:00 pm, Thursday, 2-April in 906 Gould Simpson
Main Topics (no 2D arrays):
Interfaces
Collection considerations (Object, <E>, casting, autoboxing)
Linked Structures
Stacks and Queues

Homework

If possible, before section , complete page 1 of the practice test (questions 1..6)
Read the Test Review sheet and complete this Practice Test (the handout from today for this in lecture)
Answers to practice test 2

Lecture Outline

Complete LooplessLinkedBag<E> so no loops exist
Have both classes implement the Iterable<T> interface
Consider test topics from Test Review sheet

 

Monday 30-March

Announcements

Test 2 Friday 3-April
Interfaces
Collection considerations (Object, <E>, casting, autoboxing)
Linked Structures
Stacks and Queues

Homework

Finish Minesweeper

Lecture Outline

Begin test review today with with arrays and linked structures while continuing discussion of recursion
Replace the loops in ArrayBag<E> and LinkedBag<E> with recursive solutions
Begin with the collection classes in LoopsInClassesWithIterators.zip
Should end up with code close to this handout, which is stored in LooplessClassesWithRecursionAndIterators.zip

 

Friday 25-March

Announcements

None

Homework

Work on Minesweeper

Lecture Outline

Continue Recursion 18A-SimpleRecursion.ppt 18-17 .. 18-26 
In class: Write a code with printlns (see slide 26)
Need volunteers to enter the code to see if it works

 

Wednesday 23-March

Announcements

Project 7 Linked: Minesweeper

Homework

Begin Minesweeper

Lecture Outline

Introduce Recursion 18A-SimpleRecursion.ppt 18-1 .. 18-18
Introduce current project
Play Minesweeper  http://www.gameswizard.com/j_jvmine.html
Trace the click algorithm   (also provided on the project page, the interface, and MinesweeperModel)

 

Monday 23-March

Announcements

Homework 5 is due tomorrow night @ 8:00 pm
The LinkedStack<E> part will be used in the upcoming project 

Homework

By 8:00 pm Tuesday: Implement OurStack<E> and OurQueue<E> with singly linked data structures
HomeworkOurStackOurQueue.htm
Before Wednesday Lecture, read pages 247..256 in Chapter 18: Recursion
Answer all of the self-checks answers are at the end of the chapter

Lecture Outline

17-StacksQueues.ppt
Stack applications:
Evaluating Postfix expression using a Stack
Queues
An array data structure Implementation
A linked implementation

 

Wednesday 11-March

Announcements

This Friday, lecture will be held in 930 Gould-Simpson (lab with 31 workstations) for those who have not completed ArrayPriorityList<E> and LinkedPriorityList<E>

// regarding toArray(): This code compiles but causes a ClassCastException

Object[] obj = new Object[10]; // toArray returns Object[]

String[] str = (String[]) obj; // <- RUNTIME ERROR


// Recommended: you can cast individual array elements

obj[0] = new String("abc");

String aString = (String) obj[0]; // okay

assertEquals("abc", aString);  // passes
Demo both PriorityList<E> implementations with the "movie queue" application linked from the  projects.

Homework

If necessary, work on current project
Optional:  Read Chapter 14: Algorithm Analysis online  (search for Chapter 14 in the pdf)
Some symbols went missing when Fast Copy accidentally formatted Rick's pdfs

Lecture Outline

Finish 14-AlgorithmAnalysis.ppt  Big O  23-47
Run CompareSearches.java
Consider methods in ArrayPriorityList<E> versus LinkedPriorityList<E>
Consider the Stack ADT and one application: Evaluating postfix expressions
17StacksAndQueues.ppt  2-7 and17-21

 

Monday 9-March

Announcements

Lecture will be held in 930 Gould-Simpson (lab with 31 workstations) this Friday for those who have not completed ArrayPriorityList<E> and LinkedPriorityList<E>
Tuesday, 10-March is the last day to change from audit to credit or credit to audit, or withdraw and get no credit. 
Who can drop forms?
Rick
Someone in 901 Gould Simpson 9:00-12:00 and 1:00-4:00

Homework

Read Chapter 17: "Stacks and Queues"  
Section 17.4 Implements ADT OurQueue with a singly linked structure, which is another example that may help with LinkedPriorityList<E>
Work on current project
Recommended: in LinkedPriorityList<E>, do not adjust links when raising or lowering priorities
Swap data instead

Lecture Outline

14-AlgorithmAnalysis.ppt  Big O  (Optional:  Read Chapter 14: Algorithm Analysis online (many symbols went missing from Fast Copy formatting Rick's pdfs)
Consider methods in ArrayPriorityList<E> versus LinkedPriorityList<E>

 

Friday 6-March

Announcements

Section Leader Lecture today

Homework

Work on current project

Lecture Outline

Questions on project?
Recommended: For raise and lower priority linked,  swap data, not links in next

 

Wed 4-March

Announcements

Both parts of Project 6 are now linked
There are separate WebCat projects for both parts:
ArrayPriorityList
LinkedPriorityList
Due date for both is Friday, 13-March @ 11:00 with lecture held in Gould Simpson 906 930 (if you have not completed both parts A and B)

Homework

Read Chapter 16:  Linked Structures, pages 203-227
Answer all self-checks

Lecture Outline

Testing to ensure ArrayBag.get(int index) does indeed throw an exception when index < 0 and index == size
Note: Code example for this is also listed on Part 1 of ArrayPriorityList<E>  project)
Needed on current project for sevral methods in bith implementations of PriorityList 
16-LinkedIntro.ppt
Code Demo: Finish LinkedBag<E> implement Bag<E> that was begun in the slides
Use the same unit test with Array changed to Linked
Consider part two (LinkedPriorityList<E>)  of the next project (see projects page)

 

Mon 2-March

Announcements

First part of Project 6 linked
Unusual due date due to Spring break desired early departures

Homework

Read Chapter 15, pages 185-195: Implementing a List interface and Exceptions, answer all self-checks
Optional reading, pages 195-201:  Example  code and pictures could help in Project 6A: ArrayPrioirtyList<E> implements PriorityList<E>

Lecture Outline

Code Demo: 
A generic collection the old way (with Object parameters and return types)
A generic collection the new way with type parameters
new ArrayBag<String>() and class ArrayBag<E> causes E to be String for that instance
13B-CollectionConsiderations.ppt  (part 2)
Consider part one (ArrayPriorityList<E>) of the next project (see projects page)
Due date is Friday, 13-March @ 11:00 with lecture held in Gould Simpson 906 (if necessary)

Fri 27-Feb

Announcements

GameOfLifeGUI.java is available for those who have 100% code and problem coverage
Do NOT turn this into WebCat--if you do you get a very low code coverage score

Homework

Work on Project 4: Game of Life

Lecture Outline

13A-CollectionConsiderations.ppt

 

 

 

Wed 25-Feb

Announcements

2nd part of 227 book was actually edited
However, Fast Copy (the ones that made the hard copy) accidentally formatted my pdfs and made small squares that used to be special symbols like ≥ 
Online version is okay

Homework

Work on Project 4: Game of Life
Read Chapter 13: Collection Considerations, pages 152..165, answer all self-checks 
See Rick's book page

Lecture Outline

Questions on current project: GameOfLife?
Java Interfaces  (there is a 1 page handout of 11 slides)
Code demo: Show a generic sorting algorithm that sorts an array of any type that implements Comparable
See Code demos page

 

 


Mon 23-Feb

Announcements

Project 4 WebCatted

Homework

Begin Project 4: Game of Life
It is due Tuesday 3-March at 8:00 pm
Read Chapter 12: Interfaces, pages 143..150, answer all self-checks 
Part 2: http://www.cs.arizona.edu/classes/cs227/spring09/ricksBook/CSC127B.pdf

Lecture Outline

More 2D arrays
Matrix Transpose
See code demos page with class Matrix: add, transpose, getNumCols, getNumRows
Transpose an image (same as flipping)
Discuss Project 5: Game of Life (see projects page)
See your section leader to get your test back
Average 82.4
Median 89
Max 100
Min 32

 

 

 

Fri 20-Feb

Test 1, 10:00-10:50
No homework or projects this weekend
Beat ASU

 

Wed 18-Feb

Announcements

New: Added after class:  Here are the Answers to the Practice test
Test 1 will be Friday 20-Feb

Homework

Study for the test (topics and resources are listed in the Test 1 Review Sheet

Lecture Outline

Go over Review Sheet handout
Present more explanation and examples of things that are still not clear according to your anonymous feedback from Monday
Constructors 7

Method with name of class, no return type, use to initialize the state of objects. 

Constructors assign parameter values to instance variables, cause memory to be allocated (behind the scenes) to store those values.  

We can have more than one constructor.

Demo: add constructor  public String227(int howMany, char sameChar)    

Array- grow 7

See String227 append and the growArray method in Chapter 10

Demo in String227 with duplicateAll(char charToDuplicate) 

Array- shift 5

See String227 insertCharAt

In general, find an insertion spot, move all element right by one index beginning at the end--move index from n down to insertion spot.

Or, find the removal spot, shift all elements left from that spot to end

String 227 5

A type like String except there are methods that change the state. 

A class that allows objects to remember a collection of characters. 

Some methods return state, other modify the Stirng227

It is a collection class as it stores collections of characters

Scanner 5

Scanner will only be on the test with a string argument in the constructor. 

It mimics input from an input stream such as the keyboard or an input file.

Scanner scanner = new Scanner("This input has 5 tokens") 

while(scanner.hasNext())

   System.out.println(scanner.next);

Be careful to use next, nextInt and nextDouble only once in a loop. Store the next value into a local variable.

 

Strings 5 Demo each of these, you need to memorize these 6 (hopefully the names remind you what they do:  length, compareTo, equals, substring, indexOf, charAt)

assertTrue("abce".compareTo("abde") < 0)
assertFalse("abcd".compareTo("abc") >  0)

Instance variables 4

Variables declared in the class, but not locally in any method 

Values the objects remembers. They are needed by objects to be able to do what they are supposed to

They get default values when an instance of the class is constructed

Assertions - unit test 4

Used to verify your code works (could also use printlns for small problems)

So far we only need these:

   assertEquals(anyType expected, sameType actual)

   assertTrue(boolean)
   assertFalse(boolean)

You will not have to write entire test methods (one method to verify a small piece of functionality) on the test (no imports,  no @Test)

For loops 3  
Collection classes 2 A Java class that has an array to store more than one element of the same time. Can add elements at the "end of the array".  Other insertion locations will be seen later this semester.
Sorting 2 You won't need to sort an entire array, but know about swapping array elements

 

Selected once:  Objects, Tricky Question :-), Collections-how to make, Test material, Nested loops, Go over practice test, JavaBat logic, Calculations, Array replace

 

 


Mon 16-Feb

Announcements

Career fair this week (swag and get a taste of companies for summer '10 internships)

Tuesday, Feb. 17th from 10:00am to 3:00pm

Student Union 3rd floor ballroom

Test 1 will be this Friday 20-Feb
Assertions, and  no main methods
Control structures: if, if..else, if..else-if, for loops, while loops
Scanner objects constructed with a String argument  (no console base input)
Methods
1D arrays, but no 2D arrays 
Classes with instance variables and constructors
Section leader Test review session tentatively scheduled for  confirmed: Thursday: 6:00-7:30 in 906 Gould Simpson.

Homework

Complete this practice test before your section this week: 227PracticeTest1Spring09.pdf 

Lecture Outline

Questions on current project?
Arrays with two subscripts: double[][] table = new double[3][4];   
11-2DArrays.ppt
Do an output
Code Demo: a Matrix class that ha a constructor and a 2D array instance variable
Implement get and plus as in Matrix c = a.plus(b);

 

Fri 13-Feb

Announcements

Test 1 will be Friday 20-Feb
Interested in a Thursday night section leader led review session?
Project 4 has been WebCatted  

Homework

Work on Descriptive Statistics
For Monday, read Chapter 11: 2D arrays and by Monday we are finished with the 4 unit C Sc127A course in 14/45ths  (31%) of a semester  (2D arrays will not be on the test)

Lecture Outline

Project 4: Descriptive Statistics
Consider an insertInOrder algorithm  (needs arrays shifting, sorting not allowed) 
Examples of Standard Deviation (see formula from the project
Array has { 1.0, 2.0, 3.0, 4.0, 5.0, }. stand deviation
Or to find test cases, you can use an OpenOffice or MS Excel spreadsheet function like =STDEV(A1:A6)
Any questions about the current project?   
How do you round to 1 decimal place?
There is no roundTo method, but you can use Math.round, Math.ceil, or Math.floor
Sorting Demo: Need 5 volunteers who are willing to follow Rick's instructions in front of the class
Add a sort method to String227
Remember: Do not use a sort algorithm in descriptive statistics
We need you to shift array elements instead of swapping them at this point

 

Mon 9-Feb

Announcements

WebCat certificate expired Saturday night and the Eclipse plugin would not work to Submit 
You can submit again as of early Monday morning
Rick's Office Hours were open door, They are now 
Tuesday 9:30-10:30, Wednesday 4:40-5:25, Friday 3:00-4:00

Homework

If necessary, work on ArrayFun
Read Chapter 9: A Collection Class in Rick's book answering all self-checks, pages 113-119

Lecture Outline

Java classes with constructors and instance variables
Continue code demo of String227 which is a mutable (some methods modify the object) String class 
Desired Methods (the first 4 were completed Friday, 6-Feb) 

  String227(String)  // The constructor - done

  int length()       // a getter - done

  char charAt(int)   // a getter - done

  void toUpperCase()        // modifies the object - you did this

  String toString()         // @Override String227@17AF9C

  int compareTo(String 227) // make it like String's compareTo

  void deleteCharAt(int)    // modifies the object--the array shrinks by 1 element

  void append(String227)    // modifies the object--the array grows by arg.length() 

  void insertCharAt(char, int)  // modifies the object--the array grows by 1 element

 

 

 

Wed 11-Feb

Announcements

Rick's Office Hours:  
Tuesday 9:30-10:30, Wednesday 4:40-5:25, Friday 3:00-4:00

Homework

Read Chapter 10: Sorting and Searching Rick's book answering all self-checks, pages 121

Lecture Outline

Java classes with constructors and instance variables
Code demo one more String227 method--insertCharAt algorithm can be used as part of next project

  String227(String)  // The constructor - done

  int length()       // a getter - done

  char charAt(int)   // a getter - done

  void toUpperCase()        // modifies the object - you did this

  String toString()         // @Override String227@17AF9C

  int compareTo(String 227) // make it like String's compareTo

  void append(String227)    // modifies the object--the array grows by arg.length() 

  void deleteCharAt(int)    // modifies the object--the array shrinks by 1 element

  void insertCharAt(char, int)  // array grows by 1 while using shifting array elements

Multiple constructors with String227() String227(char[] array)
One example of overloading a method
Consider scope, type and lifetime of variables in classes, see handout
Introduce project 4: Descriptive Statistics
Consider an insertInOrder algorithm  (needs arrays shifting, sorting not allowed) 

 

Mon 9-Feb

Announcements

WebCat certificate expired Saturday night and the Eclipse plugin would not work to Submit 
You can submit again as of early Monday morning
Rick's Office Hours were open door, They are now 
Tuesday 9:30-10:30, Wednesday 4:40-5:25, Friday 3:00-4:00

Homework

If necessary, work on ArrayFun
Read Chapter 9: A Collection Class in Rick's book answering all self-checks, pages 113-119

Lecture Outline

Java classes with constructors and instance variables
Continue code demo of String227 which is a mutable (some methods modify the object) String class 
Desired Methods (the first 4 were completed Friday, 6-Feb) 

  String227(String)  // The constructor - done

  int length()       // a getter - done

  char charAt(int)   // a getter - done

  void toUpperCase()        // modifies the object - you did this

  String toString()         // @Override String227@17AF9C

  int compareTo(String 227) // make it like String's compareTo

  void deleteCharAt(int)    // modifies the object--the array shrinks by 1 element

  void append(String227)    // modifies the object--the array grows by arg.length() 

  void insertCharAt(char, int)  // modifies the object--the array grows by 1 element

 

 

Fri 6-Feb

Announcements

Project 3 was WebCatted Yesterday to allow you to submit your ArrayFun project
Rick's Office Hours were open door, They are now 
Tuesday 9:30-10:30, Wednesday 4:40-5:25, Friday 3:00-4:00

Homework

Work on ArrayFun
Read Chapter 9: A Collection Class in Rick's book

Lecture Outline

Java Classes with constructors and instance variables
05-TypesAsClasses.ppt  Slides 5-1 .. 5-14
Demo an instance variable in ArrayFunTest
All methods in a class have access to its  instance variables
So we can have just one ArrayFun object as an instance variable
Consider a mutable String class with methods that modify String227 objects
Constructed like this  String227 str = new String227("Initial String");
Uses a char[] instance variable
Desired Methods

String227(String)  // The constructor

int length()       // a getter

char charAt(int)   // a getter

void toUpperCase() // modifies the object

Wed 4-Feb

Announcements

Turn in your hard copy printouts of ControlFun.java and ControlFunTest.java 
Project 3: ArrayFun is posted (see Projects page)

Homework

Complete any 12 JavaBat problems from Array-2  from the top 5 rows
Don't forget to login to JavaBat so your section leader can find your answers
Bottom row:  
 either24  matchUp  has77
Begin Project 3: ArrayFun
Read Chapter 5 in the first part of Rick's Book: Classes = Methods+ Data, answer all self-checks (answers at end of chapter.

Lecture Outline

Array processing with loops--for now we assume all arrays are full, they all have array.length meaningful elements
JavaBat demo Pick one from top five rows
Demo within ArrayFunTest and ArrayFun
public double average(double[] nums)
public void increment(double[] array, double val) 
public double[] concat(double[] a1, double[] a2) 
All three are in ArrayFun linked from the Code Demo page
Practice test question
With paper and pencil, complete method double range(double[] nums) to return the range of the floating point numbers in nums.  Return 0 if the array is empty.  First complete a unit test

 

Mon 2-Feb

Announcements

Project 2: ControlFun due Tuesday 8:00 pm via WebCat 
Bring hard copy printouts of ControlFunTest.java and ControlFun.java to lecture on Wednesday
We use this to grade the 20 "Style and Design" points for project 2 

Homework

If necessary, 
Complete Project 2:  ControlFun
Complete any 9 JavaBat problems from Warmup-2  (we won't check till Wednesday)
Don't forget to login to JavaBat so your section leader can find your answers

Lecture Outline

Any questions/concerns on current project?
Continue with the Java array objects (one subscript only)
There are two different ways to construct arrays
int[] x = new int[100];
int[] x2 = {1, 2, 3, 4 };    // slide 8-8
The capacity (max number of elements) x2 can be found with x2.length
Show array parameters in code demos to solve 3 problems on slides 8-9 and 8-11
Test methods go into ArrayFunTest,java
Methods go into ArrayFun.java


Fri 30-Jan

Announcements

Project 2: ControlFun is now WebCatted (I usually WebCat projects two days after assigning to avoid confusion with the previous project)

Homework

Work on ControlFun
Before Monday's lecture
Read about 1D arrays in Chapter 8, pages 101-112 of Rick's book
JavaBat:  Complete any 9 JavaBat problems from Warmup-2  
Don't forget to login to JavaBat so your section leader can find your answers

Lecture Outline

Code demos: two more while loops
Change squareRoot to include an allowable error factor. Make an unknown number of approximations of the square root of a number using the Newton/Raphson formula: app = 0.5 * (app + x / app); in method  double squareRoot(double x, double error)
Find the longest word in a Scanner int longestWord(Scanner scanner). If there are two of the longest length, return the String closest to the end of the stream of strings
Any questions in the current project: ControlFun?
Begin 08-Arrays , 8-1..8-12


Wed 28-Jan

Announcements

Project 2 Linked, due Tuesday 3-Feb by 8:00 pm.
Two printouts due Wednesday 10:00 am in lecture

Homework

Read about indeterminate loops, while loops, and Scanner (String) in Chapter 7, pages 88 - 93
Work on Project 2: ControlFun

Lecture Outline

07B  The Indeterminate loop pattern and Java's while loop
Code demos
Count the number of 100s in the Scanner int num100s(Scanner scanner)

 

Mon 26-Jan

Announcements

Tonight you should be getting an email from WebCat with your WebCat account name and a randomly generated password
You will this info this to complete homework due Wednesday at 8:00 pm

Homework

Complete Homework TwoMethods with a Unit test for another class with two methods.
Submit to WebCat by 8:00 pm Wednesday
If necessary, read about repetition (for loops and while loops) in Chapter 7, answer self checks from Rick's book or some other source

Lecture Outline

07A  The Determinate loop pattern and Java's for loop
Writing methods with selection statements tested by a JUnit test
Use ControlFun and ControlFunTest to implement these methods that are  determinate loops
find sum of integers in from any one int to another int:  int sumInRange(int start, int end)
make 10 approximations of the square root of a number using the Newton/Raphson formula: app = 0.5 * (app + x / app);   double squareRoot(double x, int n)
Demonstrate submitting to WebCat  (follow homework)

 

Fri 23-Jan

Announcements

Turn in project 1 to your section leader: Four printouts stapled together
Repeating in case you missed it:  Room change for Will's Section 4, Thu, 9:00-9:50
It is now in 942 Gould Simpson  (was Engineering)
Please help future students as they have helped you (the first 12 chapters have not been edited, there may be--actually probably are--typos)
Report any typos in your book to Rick
I will recommend two books if you want published material with very few typos

Homework

First: read about if and if..else statements in Chapter 6, pages 69..74 from Rick's book
Before Wednesday, 28-January's 10:00 a.m. lecture (Project 2 will be posted Monday)
Go to the JavaBat website http://javabat.com/ and create an account
Click the link in the top row create account, enter your info in the three fields and click the Create Account button
Back at http://javabat.com/, click prefs. Under Teacher share (bottom field) enter your section leader's email address (to get credit for this homework)
CS227-1 Wed 12:00 -12:50 PM Matt swatzell@cs.arizona.edu  
CS227-2 Wed 1:00 - 1:50 PM Robert  rsidur@cs.arizona.edu
CS227-4 Thu 9:00 - 9:50 AM Will  wsnavely@cs.arizona.edu
CS227-5 Thu 10:00 - 10:50 AM Megan  megan@cs.arizona.edu
Do any 3 problems from WarmUp-1  http://javabat.com/java/Warmup-1 (answers are available)  1 gold star and 3pts
Complete any 12 from String-1 http://javabat.com/java/String-1  for 4 gold stars and 12pts
Complete any 9 from Logic-1 http://javabat.com/java/Logic-1  for 3 gold stars plus 9pts

Lecture Outline

Demonstrate String methods in Assertions and Eclipse
charAt, length, compareTo, and substring
Methods  4-2 ..4-11
Selection 6-2..6-15
Demonstrate JavaBat http://javabat.com/

Wed 21-Jan

Announcements

Project 1 due this Friday" Four printouts stapled together
Room change for Will's Section 4, Thu, 9:00-9:50
It is now in 942 Gould Simpson  (was Engineering)

Homework

Reading for Friday, 21-Jan
Chapter 4: Methods
If you haven't done so, get your CS account ASAP (for Windows and Unix)  with this apply program

Lecture Outline

Introduce Objects and JUnit  3-1 .. 3-20
New types: BankAccount and String (methods charAt, length, indexOf, compareTo)

 

Fri 16-Jan

Announcements

As of 1:30pm Thursday, hardcopy versions of the C Sc 227 Textbook for Spring 2008 were available in the UofA bookstore. 
Project 1 is posted (see projects page)

Homework

Readings for Wednesday, 21-Jan
Chapter 3: Objects, pages 36..47 
Work on Project 1, at least the first three problems
If you haven't done so, get your CS accounts (for Windows and Unix)  with this apply program

Lecture Outline

02-JavaFundamentals
Consider the current project
Due next Friday 23-Jan at the beginning of class
Four printouts must be printed in the lab and stapled before class
You may work at home and print all four in the lab
For train Departure, use Math.abs(trainATime-trainBTime)  to get a positive difference

 

Wed 14-Jan

Announcements

C Sc 227 Textbook for Spring 2008 was written by your instructor. A hard copy version will be available in the UofA bookstore after the first day of class (price TBA, but probably less than $23). It is also provided to you free online this semester. See Rick's Book, which is in two parts.

Homework

Readings by Friday
Syllabus
Chapter 1, pages 1-11, answer all self-checks (answers at end of chapter). No turnin.
Chapter 2, pages 13-24 answer all self-checks (answers at end of chapter). No turnin.
To get your CS account, run this apply program before Friday's class lecture from your own Internet connected machine or go to 930 Gould-Simpson between 8:00 and 5:00 pm.

Lecture Outline

Peruse a few relevant details in the Syllabus
Program Development: Write a program to compute the grades for C Sc 277, Spring 2009.
See Rick for adding or switching sections