This website is preserved for historical and scholarly reference and is no longer actively maintained.

Reading Assignments and Reading Homework

CPSC 210 -- Fall 2001

The following reading assignments are made. Homework, in the form of a synopsis of the reading assignment or other designated assignmnet, will be collected at the beginning of the designated class meeting. The intention of these assignments is (1) to persuade everyone to read the text books, (2) to allow the instructor more time to emphasize major concepts and critical points in the text material, and (3) to allow class discussions to introduce material not covered in the text.

Homework not turned in when collected in class will be designated "late." Late homework will be accepted until 4 p.m. on the date the homework is due. Homework will not be accepted after 4 p.m. on the date due except in exceptional circumstances. Late homework will receive a 2 point (out of 10 points) penalty. Homework will not be accepted by email. If class is cancelled due to inclement weather, the homework will be due at the next class meeting.

The text of homework must be typed (unless specified otherwise) using new Roman Times or Times 12 pt. font, single spaced, and double spaced between paragraphs. Figures may be (probably should be) hand-drawn. Unless specified otherwise, it is expected that the synopsis be at least 1.5 pages in length. Homework must have the name of the person submitting the homework typed at the top of the first page. All pages must be stapled together. Failure to follow instructions will result in deduction of points (1 pt. for no name, 1 pt. for not correctly stapled).

These homeworks will be valuable to you. You will probably be allowed to use your synopses on some daily quizzes, on some part of some hour quizzes, and on some part of the final exam. Therefore, you should organize your work so that you can make the best use of it as a reference.

Homework is to be done individually. The purpose of the "read and report" homework is to make it possible to cover the course material effectively. Thus, it is important that each person read and write for themselves. If the instructor believes that homework has been jointly written, on the first occurrence the grade will be shared jointly among the writers. A second occurrence will be considered academic dishonesty and appropriate action will be taken.


#1 (due Monday, August 27)

Read Chapter 2 of Java Elements and write a synopsis of this chapter (5 pts.).

Using Appendix E (pages 305-326) write statements that draw a square with sides of length 100, centered at (75,125). (5 pts.)

#2 (due Wednesday, August 29)

Read Chapter 3 of Java Elements and write a synopsis of this chapter (5 pts.).

Using Appendix E, complete the method below. (5 pts.)
          public static void drawRightTriangle
               (DrawingWindow d, Pt a, Pt b)
          // Pre:  The x-coordinates of points a and b are not identical
          //       The y-coordinates of points a and b are not identical.
          // Post:  A right triangle with hypotenuse ab is drawn.


#3 (due Friday, August 31)

Read Chapter 4 of Java Elements and write a synopsis of this chapter (5 pts.).

Complete the method below, taken from Exercise 3.9 on page 93. (5 pts.)
          public static void drawCheckerboard ( )
          // Post:  The checkerboard of Problem 3.3 is drawn using exactly
          //        two Rect objects, each drawn exactly four times.


#4 (due Monday, September 3)

Read Chapter 5 of Java Elements and write a synopsis of Chapter 5 (5 pts.).

Write a method that draws n random points in a drawing window. Assume the default size of the window (200 x 200). (5 pts.)

#5 (due Wednesday, September 5)

Using Problem 3.1 on page 92 as a guide, complete the method below (10 pts.). This method should be a member of a class named LeapYear. The method must be typed to be acceptable.
          public static boolean isLeapYear ( int year )
          // Pre:  year is >= zero
          // Post:  If year is a leap year, true is returned.
          //        Otherwise, false is returned.

#6 (due Friday, September 7)

Read Chapter 6 and write a synopsis for Chapter 6 (5 pts.)

Complete the following method, from Problem 6.10 on page 159 (5 pts.)
          public static int remainder ( int n, int m )
          // Pre:  n >= zero and m > zero
          // Post:  returns the remainder when n is divided by m
          //        (method is recursive)

#7 (due Monday, September 10)

Complete an iterative method (i.e., uses a while loop, not recursion) to construct a String that is the binary representation of an integer. (10 pts.)
          public static String binaryRep ( int n )
          // Pre:  n >= zero
          // Post:  returns the binary representation of n as a String
          //        (method is iterative, not recursive)

#8 (due Wednesday, September 12)

Read Chapter 7 and write a synopsis for Chapter 7 (5 pts.)

Complete a method that reverses the order of the elements in an array of its. (Problem 7.6 on page 190) The method may be either iterative or recursive. (5 pts.)
          public static void reverseArray ( int [ ] intArray )
          // Post:  the order of the elements of intArray are reversed.

#9 (due Friday, September 14)

Read Chapter 8 and write a synopsis for Chapter 8 (5 pts.) and answer the following questions (5 pts.).
Name the instance variables of an Object of class Button.
Name the instance variables of an Object of class Die.
Name the instance variables of an Object of class Watch.
Name the instance variables of an Object of class WordList.
In class Square, explain the statement
       super(left,top,d,d);

#10 (due Monday, September 17)

The following method ask for a solution to problem 6.12 on page 159 when the value of x is positive. Problem 6.12, where x is allowed to be zero or negative, is more difficult. The method must be recursive, the only operation used is multiplication, and a minimum number of multiplications must be used. Consider x^9, which can be computed by (x*x*x*x*x*x*x*x*x), but should be computed by (x*(((x^2)^2)^2), as shown in class. Complete the following method (10 pts.)
          public static int power ( int x, int exp )
          // Pre:  x > 0 and exp >= 0
          // Post:  returns x to the exp power

#11 (due Wednesday, September 19)

Read Chapters 10 and 11 of Java Elements and submit answers to the following que stions. (10 pts.)

for Monday, September 24

Read chapter 0, 1 & 2 of Java Structures. No written work to turn in.

#12 (due Wednesday, September 26)

Answer the question: What can be assumed if a method has no precondition?

Complete the following methods as part of the Ratio class:
          public boolean equals ( Ratio other )
          // pre:  other is non-null  
          // post:  return true if this and other represent the same
          //        fraction mathematically
          //        otherwise, return false

          public String toString ( )
          // post:  return String representation of this
        
Examples:  if this = 1/2 and other = 3/6, then equals(other) returns true
           if this = 2/3 and other = 3/6, then equals(other) returns false
           if this is 2/3, then toString() returns the String "< Ratio: 2 / 3 >"
           if this is 4/8, then toString() returns the String "< Ratio: 4 / 8 >"


#13 (due Monday, October 1)

Read chapter 3 of Java Structures. Turn in a synopsis of Chapter 3 (10 pts.)

#14 (due Friday, October 5)

Read Chapter 4 of Java Structures. Turn in a synopsis of Chapter 4 (10 pts.)

#15 (due Monday, October 8)

Prepare and turn in a spreadsheet giving your grades to date. (10 Pts.)
This spreadsheet should contain:

     1. Your hour quiz grade, clearly labelled
     2. A list of your daily quiz grades, clearly labelled as Q1, Q2, ...
        and the average of the daily quiz grades, also clearly labelled.
        (For the purpose of this assignment, do not drop any grades.)
     3. A list of your homework grades, clearly labelled as HW 1, HW 2, ...
        and the average of the homework grades.
     4. An estimate of your grade at this point in the semester.
        For this estimate, add the hour quiz grade and the two averages
        and divide by 3.

Do this on exactly one sheet of 8.5 x 11 paper.   Use only one side of
the paper.  Part of the grade will be clarity of presentation.         

#15 (due Wednesday, October 10)

Read Chapter 5 of Java Structures. Turn in a synopsis of Chapter 5. (5 pts.) Work problem 4.3 on page 73. Include in your work a table showing the number of times the loop is executed and the final value of result for the following values of n: 1, 2, 4, 8, 16.

#16 (due Friday, October 12)

Read Chapter 6 (Lists) of Java Structures. Turn in a synopsis of Chapter 6 (5 pts.) and answer questions 5.5 (1 pt.) and 5.6 (4 pts.) on page 96.

Read Chapter 7 (Linear Structures) for Wednesday, Oct. 17.

No work to turn in.

#17 (due Friday, Oct. 19 )

Turn in synopsis of Chapter 7 (5 pts.) and work problem 6.16 on page 125 (5 pts.).

(Monday, Oct. 22)

No written assignment. Will collect homework #17.

Wednesday, Oct 24: Hours Quiz 2


#18 (due Friday, Oct. 26)

Turn in a synopsis of Chapter 8. (5 pts.) Work problem 7.3 on page 152 (5 pts.) Your answer to problem 7.3 should be include a clearly understandable algorithm written in English sentences.

#19 (due Monday, Nov 5)

Write a synopsis of Chapter 9 (Comparable Objects, 10 pts.). The following are suggestions for inclusion in your synopsis, but will not be graded for inclusion/exclusion or correctness. You might particularly want to note the distinction between equals and == on page 167. You also should be sure you understand the operation of the code on page 174, tracing execution of the code for some simple value of the parameter target. What does this code return? Can you explain the operation of the OrderedList? Consider the problems on page 185, especially the first several problems.

#20 (due Friday, Nov 9)

Write a synopsis of Chapter 10 (Trees, 10 pts.). You might want to demonstrate your understanding of constructing a tree with Bailey's methods by constructing the tree in problem 10.1 on page 219. You could also identify the leaves, root, height of the tree for this tree. You could also give the preorder traversal, inorder traversal, and postorder traversal of this tree. The definitions of full binary tree and complete binary tree are important. Problem 10.3 on page 219 is a nice problem. You could demonstrate your understanding of the property-based methods on pages 210-214 by tracing code. OMIT Section 10.7 (Huffman compression). Can you propose an algorithm for constructing an expression tree?

#21 (due Friday, Nov 30)

Write code for a method in an extension of the class BinarySearchTree (10 pts.):
          public boolean isBSTree ( BinaryTreeNode root )
          // pre:  root is not null
          // post:  returns true iff root is the root of a Binary Search Tree
using Definition 12.1 on page 249: A binary tree is a binary search tree if it is trivial, or if every node is simultaneously greater than or equal to each value in its left subtree, and less than or equal to each value in its right subtree.

Must be typed. May be done in groups (bring an extra copy to class in case the person designnated to turn in the homework oversleeps).

Return to Eleanor Hare's home page.

Return to Department of Computer Science Home page.