UNCW Home UNCW Home
 CSC 121 - Introduction to Computer Science I 

only search tompkinsj

LECTURE   

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
      P1       P2    T1  
      P3     P4   T2    

Syllabus    /    Glossary    /    CodeLab    /    Algoritharium /    Blackboard

 May 17 First day of classes     

  1. In class - Your First Program (click the In class link to get the pdf) Reading: pp 4-12
    Highlights:  1.1.1 p.6  Hello World
    OS X / Linux / Windows
    % javac HelloWorld.java
    % java  HelloWorld

    where % represents the command line prompt in the current directory

    Objectives:
    1. Using text editor
    2. verify installation of JDK
    3. competency with javac and java commands
    4. work with command line arguments
    5. introduce array notation
    6. Java Syntactical Structure
    7. HelloWorld vocabulary - click on each vocabulary word

    Guided Exercise - Lab 1  (do all of the lab exercises)
                   
    Codelab: (graded drill and practice with feedback) Complete section 1.1 Your First Program All five problems.
     

  2. May 18 In class - Built-in Types of Data  (basic definitions / trace / text / integers) Reading: pp 14-22, 35
    Highlights: 1.2.3 p.20 Quadratic formula 
                    1.2.4 p.27 LeapYear              
    Objectives:
    1. Identifiers,
         Literals, and
         Variables p. 15
    2. Statements:
         declarations,
         assignments, and
         initialization p. 17
    3. Tracing changes in variable values p. 17
    4. data types:
         String,
         int pp 19, 21
    5. source files, class files
    6. BuiltInTypes vocabulary -be sure to click on each vocabulary word

    Codelab: (graded drill and practice with feedback) Complete section 1.2 Built-in Data Types subsection Integers (19) problems
       Integers - Literals 20519-21
       Integers - Constants 20522-23
       Integers - Declarations 20524-28
       Integers - Operations 20529-35
       Integers - Precedence 20536-7

  3. May 21 Reading: pp 22-38
    In class - Built-in Data Types (floating-point numbers / Math Library / Booleans / Comparisons):
    Objectives:
    1. Boolean, numeric types (double, long) pp 25, 32
    2. Comparisons - Booleans and Comparisons
    3. Math class methods, API, p. 29
    4. Anatomy of a method signature p. 30
    5. Type conversion pp 31, 32
    6. BuiltInTypesII vocabulary

    Guided Exercise - Lab 2  (do all of the lab exercises) 

    Quiz 1 May 21-22 in Blackboard -be sure to log in to your account prior to class: User ID is your UNCW email without the @uncw.edu, password is your six digit SeaNet password...  under Assessments. Note, no makeups- the quiz is a milstone for establishing your progress.

     Codelab: Complete section 1.2 Built-in Data Types subsections Floating Point (10) and Boolean (22) problems
       Floating Point - Literals 20539-40
       Floating Point - Declarations 20541-43
       Floating Point - Operations 20544-48
       Boolean - Literals 20549
       Boolean - Declarations 20551
       Boolean - Relational Operators 20608, 20552-60
       Boolean - Logic Operators 20561-5, 20610-11
       Boolean - Boolean Variables 20609, 20612-13

     


    top 
  4. May 22 In class - Conditionals and Loops (control flow / conditionals / while loop / for loop / nesting): Reading: pp 47-57, 74 conditionals and loops, 1.3.1  p 49 Flipping a fair coin, 1.3.2 p. 51 Your first while loop, then extend 1.3.1 to count number of times heads/tails come up in a loop, extend to count outcomes for rolls of a six sided die with a variable for each outcome. Accumulating a sum p. 57 examples (all), nested loops, 1.3.7 p 64 Converting to binary, 1.3.9 Factoring Integers, FairDie.java 
    Objectives:
    1. flow of control
    2. while loops
    3. for loops
    4. conditional operator:  int min = (x < y) ? a : b;
    5. algorithms
    6. looping examples
    7. debugging
    8. Conditionals and Loops vocabulary

    Guided Exercise - Lab 3  (do all of the lab exercises   -MAC users tips for working with the algoritharium) 

    Want to program in java with Eclipse on another computer? Consider running Eclipse/Java off of your jump drive: Place the Eclipse folder and the JDK folder (from your Program Files/Java/ directory) on your jump drive then modify the eclipse.ini file in the Eclipse folder on your jump drive by adding two lines before the -vmargs option. First the -vm to specify the JVM to use and that the path to the jdk follows, then on a separate line the full path to javaw.exe. http://wiki.eclipse.org/Eclipse.ini Here is one example with my particular version of jdk. Yours will be different: 
    -vm
    E:\jdk1.6.0\bin\javaw.exe

    Codelab: Complete section 1.2 Built-in Data Types subsections Character Type, Conversions and Casting, Assignment, and Review (23 problems)
       Character Type - Literals 20566-70
       Character Type - Declarations 20571
       Conversions and Casting 20758, 20572
       Assignment - Simple 20591-2
       Assignment - Compound 20593-97
       Assignment - Boolean Assignmnet 20756
       Assignment - String Variables 20757 -look up swap -variable values in the index but instead of working with int t and int a and b work with String t, and s1 and s2.
       Assignment - 4 Variable Rotate 20769
       Review 20510-14
      

    Program 1 Assigned: (on your own program assignment due Tuesday, May 29th) Create a simple plotter (x-axis runs vertically, y -axis runs horizontally) using command line arguments for a (left end point), b (right end point), and n (number of sub-intervals of [a, b].) Plot.pdf Steps:

    1. compute maximum and minimum values of the function on [a, b].
    2. compute scaling factor sf. For example, does the following accomplish all we need?
      sf = graphPageWidth/(max - min).
    3. construct for each point in the interval the required number of spaces (one for each column) preceding the plot (an *)
      #cols = sf ( f(a +idx) - min ).
      Points breakdown
      • 0 - doesn't compile
      • 20 - Input and output a, b, & n
      • 40 - Calculate and print dx
      • 60 - Find and print the max & min on [a, b]
      • 80 - Find and print the scale factor
      • 100 - Plot the function x3 on [a,b] in one program and
                   1 - x2 on [-1, 1] in another. You will be required to demonstrate your program using a test function provided in class on the date delivery is due.
                    Sample output: a, b, c, d.

  5. May 23 In class - Arrays ( array processing code / setting array values at compile time)Reading: pp 58-76  FairDie.java variables in context of args[] develop an array f. Using this transformation, 
    1. We can have as many faces as desired using a runtime argument
    2. The code is much quicker to implement
    3. Shorter code is easier to debug
    4. Recall tmp = (int)(Math.random()*6 + 1)
      1. How can this be adapted to n faces?
      2. How can tmp be used to count the outcomes?
       
    5. Initialization is simplified
    6. Output of results is simplified
    7. Typical array processing code (for arrays of N double values)

    Codelab: 1.3 Conditionals and Loops (24 problems)
       Conditionals - Statements - Simple if 20614-7
       Conditionals - Statements - Simple if-else 20618-20
       Conditionals - Statements - Cascaded 20621-2
       Conditionals - Expressions 20624-5, 20768
       Loops - for 20689, 20674-7, 20686-8            (screen cast -for loop demo)
       Loops - while 20678-81
     

  6. May 24 In class - Arrays (multidimensional arrays / setting 2D array values at compile time / array addition / array multiplication / memory representation)Reading: pp 88-91 Array processing
    Objectives:
    1. arrays
    2. zero-based indexing
    3. array length
    4. memory representation
    5. bounds checking
    6. setting array values (initialization) at compile time
    7. setting array values at run time

    Quiz 2 May 24-25 in Blackboard
    Codelab: Complete section 1.4 Arrays subsections Assignment, Declaration, and Initialization (17 problems)
       Arrays - Assignment 20699-709
       Arrays - Declaration 20690-1
       Arrays - Initialization 20692-4, 20759

  7. May 25 In class - Arrays (multidimensional arrays / setting 2D array values at compile time / array addition / array multiplication / memory representation)Reading: pp 92-101 continue with Array processing
    Objectives:
    1. arrays
    2. zero-based indexing
    3. array length
    4. memory representation
    5. bounds checking
    6. setting array values (initialization) at compile time
    7. setting array values at run time

    Guided Exercise - Lab 4  (do all of the lab exercises) 

    Guided Exercise - Program 1 guidance

    Codelab: Complete section 1.4 Arrays (10 problems)
       Arrays - Access 20695-8
       Arrays - Array Sum Snippet 20792
       Arrays - Array Average 20710
       Arrays - String Array Traversal Snippet 20765
       Arrays - Array Reversal 20711-2
       Arrays - Counting Array Elements 20716
     


  8. top May 29 Reading: pp 102-112  Program 1 due (upload your zipped project folder to Blackboard)
    In class - Arrays: Multidimensional Arrays, Flow of Control, Flow charts, Array processing
    Objectives:
    1. Matrix addition
    2. Matrix multiplication
    3. Primitive datatypes review
    4. looping examples review
    5. typical array processing code review

    Guided Exercise - Lab 5  (do all of the lab exercises)
     

    Quiz 3 May 29-30 in Blackboard  

    Codelab:
    Complete section 1.5 Input and Output (5 problems)
       Input and Output 20507-9, 20606, 20743

    Program 2 Assigned due Monday, June 4th: Flags Project: Create a java class named Flags with six/seven methods, each of which creates one of the following flags. (Guidance from a student)

    1. 25 pts: red/green/blue horizontal stripes
    2. 50 pts: red/green/blue vertical stripes
    3. 60 pts: checkerBoard
    4. 70 pts: cross
    5. 80 pts: inset
    6. 90 pts: quad
    7. 100 pts: An interesting flag of your own design (must have all 100 pts to be eligible for bonus points.)   
  9. May 30 In class - Input and OutputReading: pp 120-136, 152 Algoritharium Basic Image Filter Design.
    Screen cast -User input via the keyboard, working with double arrays in the Algoritharium

  10. Jun 1-2 First Interim Exam in Blackboard  All assignments due prior to the interim must be completed and graded before the interim.

  11.  Jun 4  In class - Static Methods (function / scope / flow of control / Gaussian distribution / overloading / multiple arguments): Reading: pp 183-198 last day to withdraw with a w  Chapter 2 Functions. 
    Guided Exercise - Lab 6  (do all of the lab exercises) 

    Codelab: Section 2.1 Static Methods (10 problems)
       Static Methods - Method Definitions 20651-8
       Static Methods - Arrays and Methods 20650, 20659

    Strings.

     We've been using strings and string concatenation since our very first Java program. Now we will explore many additional operations built in to Java's String data type that open up the world of text processing. Before using them, we must know their calling conventions. The Application Programming Interface (API) describes the set of operations associated with a data type and how to invoke them. You can find formal descriptions in Sun's online documentation of the String class. The table below summarizes several useful string processing methods and gives brief examples to illustrate their usage. As with arrays, the characters of a string are indexed starting at 0.


    Operation Description Invoking string s Return value
    s.length() return length of s Hello 5
    s.charAt(1) return character of s with index 1 Hello e
    s.substring(1, 4) return substring from 1 (inclusive) to 4 (exclusive) Hello ell
    s.substring(1) return substring starting at index 1 Hello ello
    s.toUpperCase() return upper case version of s Hello HELLO
    s.toLowerCase() return lower case version of s Hello hello
    s.startsWith("http:") does s start with http:? http://www.cnn.com true
    s.endsWith(".com") does s end with .com? http://www.cnn.com true
    s.indexOf(".java") return index of first occurrence of .java in s (-1 if no occurrence) Hello.java.html 5
    s.indexOf(".java", 6) return index of first occurrence of .java in s, starting at index 6 Hello.java.html -1
    s.lastIndexOf(".") return index of last occurrence of . in s Hello.java.html 10
    s.trim() return s with leading and trailing whitespace removed " Hello there " "Hello there"
    s.replace(",", ".") return s with all occurrences of , replace by . 13,125,555 13.125.555
    s.compareTo("abc") compare s to abc lexicographically "abc" 0

    Program 2 due (upload your zipped project folder to Blackboard)

  12.  Jun 4 part 2  In class - Static Methods (function / scope / flow of control / Gaussian distribution / overloading / multiple arguments): Reading: pp 199-208   Chapter 2 Functions continued
    Objectives:
    1. Static methods vocabulary

    Guided Exercise - Lab 7  (do all of the lab exercises) 
    Codelab:
    Complete section 2.1 Static Methods (14 problems)
       Static Methods - More Examples 20660-4
       Static Methods - Methods with Strings 20840-5
       Static Methods - Finding Extremes 20717-9
     


  13. top  Jun 5
    TotalBeginnerCompanionGuide (lessons 1-3 only) / lesson01 / lesson02 / lesson03 / debugger-lesson01 / lesson02 / lesson03 / archive.zip
    This is a nice approach to working with objects using Eclipse. The TotalBeginner series is rather long, but you may find the first three lessons helpful as we approach the biggest hurdle for programming in Java -defining our own data types. The TotalBeginner series is optional with the exception of debugger-lesson01 checked via the Debug Quiz in Blackboard.

    A complex number is a number of the form x + iy, where x and y are real numbers and i is the square root of -1. The number x is the real part and y is the imaginary part. Developing this datatype is a prototypical example of object-oriented programming.

    Guided Exercise - Lab 8  (do all of the lab exercises)

    Program 3 assigned, due Monday, June 11, in Blackboard
     
  14. Jun 6 Chapter 3 section 3.1 Data Types
    In class - Data Types (objects / constructors and methods / Color data type / String data type / text processing)Reading: pp 315-361, 359

    Debug Quiz June 6-7
    Codelab: Complete section 3.1 Data Types (15 problems)
       Strings - Comparison 20598-601
       Strings - Concatenation 20847-8, 20810
      
    Conditionals - Expressions 20624-5, 20768, 20787
      
    Conditionals - MaxMin 20602-5
       Data Types - Reference Types 20516-18

     

  15. Jun 7 Chapter 3 section 3.2 Creating Data Types
    In class - Creating Data Types (defining data types / a simple client / anatomy of instance variables / anatomy of a constructor / anatomy of a data type method / anatomy of a class / Complex numbers / Mandelbrot set): Reading: pp 370-390  
     Some useful classes:
    Class: Point ScreenCast Fraction Quadratic ScreenCast
    private
    instance
    variables
    int x,
    int y
    int num,
    int denom
    double[] coef,
    int n
    constructor(s) public Point (int x, int y) public Fraction (int n, int d) public Quadratic (double a, double b, double c)
    public
    methods
    public String toString ()
    public double distance (Point b)
    public String toString ()
    public Fraction add (Fraction b)
    public Fraction sub (Fraction c)
    public Fraction simplify ()
    public Fraction inverse ()
    public Fraction multiply (Fraction b)
    public String toString ()
    public double evaluate (double x)
    public double[] getQuadRoots ()

    Codelab: Complete section 3.1 Data Types (16 problems)
       Data Types - Creating Objects 20585-90, 20764, 20771, 20782
       Data Types - Invoking Object Methods 20578-84

     
  16. Jun 8 Chapter 3 section 3.2 Creating Data Types continued
    In class - Creating Data Types (defining data types / a simple client / anatomy of instance variables / anatomy of a constructor / anatomy of a data type method / anatomy of a class / Complex numbers / Mandelbrot set): Reading: pp 391-405  

    Guided Exercise - Lab 9  (do all of the lab exercises)

    Mandelbrot Set  Plot (x, y) black if z = x + y i is in the set, and white otherwise.      Jonathan Coulton + Mandelbrot Set

    Mandelbrot Set: z = x + yi in the set -> black

        No simple formula describes which complex numbers are in the set. Instead, describe using an algorithm:
                         Iterate zt + 1 = (zt )2  + z0.
                        If | zt | diverges to infinity, then z0 not in set;
               otherwise
    z0 is in set.

    An interesting part of Mandelbrot set between (-1.5, -1) and (0.5, 1). Fractal is a geometric shape that can be divided into parts, each of which is (approximately) a reduced size copy. Can model complex rugged shapes algebraically (unevenness of clouds, contours of mountains, winding riverbeds). Also useful for image compression and art. 

    Codelab: Section 3.2 Creating Data Types (7 problems)
       Creating Data Types - Static members 20638-42
       Creating Data Types - Minimal 20626-7
     

  17.  Jun 11 Chapter 3 section 3.3 Designing Data Types In class - Designing Data Types (encapsulation / immutability /final access modifier): Reading: pp 416-426 

    Program 3 due (upload your zipped project folder to Blackboard)

    Program 4 assigned: Name That Shape
    due Monday, June 18th
     

    Codelab: Complete Section 3.2 Creating Data Types (9 problems)
       Creating Data Types - Instance Variables 20628-32
       Creating Data Types - Constructors 20633-7
     


  18. top Jun 12  Chapter 3 section 3.3 Designing Data Types
    In class - Designing Data Types (encapsulation / immutability /final access modifier): Reading: pp 427-449 

    Guided Exercise - Lab 10  (do all of the lab exercises)

    Codelab: Section Class Definition Practice  (10 problems)
       Class Definition Practice - GetSet-- Go! 20744-7
       Class Definition Practice - Counter 20725-29
       Class Definition Practice - Accumulator 20730-35
     

  19. Jun 13

    Quiz 4 June 13-14 in Blackboard

    Codelab: Section Class Definition Practice  (9 problems)
       Class Definition Practice - Gas Tank 20736-8
       Class Definition Practice - Book 20739-40
       Class Definition Practice - ParkingMeter 20741-2
       Class Definition Practice - Value 20772, 20760
    Complete all outstanding CodeLab assignments.
    Note that a few sections of Codelab are available as "extras" and are not graded, however any that you get right will improve your grade as your CodeLab grade can be as much as 105% of 100. These are Interlude: Some Techniques (9), Interlude: Invoking Methods (17), and Extras (28). 

  20. Jun 14 Through Interim II Java Language keywords     
    Second Interim Exam, June 14-15, -Blackboard available for 48 hours
     
  21. Jun 15  Online Spots available Please take a minute to fill out the form.   
     
  22. Jun 18 (last day of classes ) Program 4 due (upload your zipped project folder to Blackboard)
  23. Final Exam Tuesday, June 19th Log into Blackboard to start your timed 3-hour final. Do not start your final until you have a full 3-hour window in which to complete your final (available for 24-hours only.)
Key dates:
Program 1 due Tuesday, May 29th
Program 2 due Monday, June 4th
Program 3 due Monday, June 11th
Program 4 due Monday, June 18th
Quiz 1 May 21st
Quiz 2 May 24th
Quiz 3 May 29th
Debug Quiz June 6th
Quiz 4 June 13th
Interim I June  1st
Interim II June 14th
Final Exam June 19th

BACKValid CSS!  Valid HTML 4.01 Transitional