CS 1063  Week 10:  Exam 2 Review  

Objectives

Assignments


Material to Review

For Java programming, review your labs, your Projects 1 and 2, and the activities from the lecture notes.  Some of these will likely be part of the exam.

For general knowledge, review Chapters 1-4, Supplement 3G, your quizzes, and the lecture notes.  Understanding the chapter summaries and self-check problems is a good way to start reviewing the book material.  Below is a table of particular items to pay attention to:

  Reading     Chapter Summary     Self-Check Problems  
Chapter 1 Everything 6, 8, 15-17, 19-27
Chapter 2 Everything 1-7, 14-15, 20-22, 27-28
Chapter 3 Everything 1-19
Supplement 3G     Everything 1-4
Chapter 4 Everything except System.out.printf 1-26

The terminology, notation, and keywords are in addition to the lists in the Exam 1 Review.

Terminology Notation         Keywords
branch != else
class && equals
control structure < if
counter <= new
cumulative algorithm         == return
exception > void
index >=
object | | Character
parameter DrawingPanel
precondition Graphics
postcondition Math
return type Scanner
roundoff error String
test

Additional Activities

Write a method that has two parameters, a Scanner and a String, and returns an int.  The method should use the String to prompt the user and use the Scanner to input the value.  That is, we want to replace this code:
System.out.print("Enter your favorite integer: ");
int favorite = console.nextInt():
with:
int favorite = getInt(console, "Enter your favorite integer: "):
Write two other methods, one for inputting a double and the other for inputting a String.  Write a Java program for testing your methods.
Write a Java program that draws the following pattern on a DrawingPanel:
A DrawingPanel with blue diagonal lines one direction and red
     diagonal lines the other direction
Hint: Don't be afraid to draw lines that start or end outside the window.
Write a Java program that inputs two doubles from the user and determines which arithmetic operations (+, -, *, /, %) on the two numbers produce the highest and lowest values.
Write a Java program that inputs an int from the user and sums all the numbers between zero and the input value.  If the user enters a negative value, the program should sum the negative numbers down to that value.  For example, if the user enters -4, the program should print -10.
Write a Java program that inputs two Strings from the user and determines whether the two Strings are equal.  If they are not equal, the program should determine whether one string is contained in the other.
Write a Java program that inputs lines from the user and counts the number of blanks in each line.  This program should ask the user for the number of lines to be entered.  It should throw an IllegalArgumentException if the user enters a zero or a negative number.  This program should have a method with a String parameter that returns the number of blanks contained in the String.

Revision Date Mon Sep 20 2010 14:40:05 GMT-0500 (CST)