Codingbat Problems

Chapter 2: Exercises 1-16

Chapter 7: Arrays

Chapter 8: Grocery Classes

Chapter 10: ArrayLists

Test #1 printDesign.java
Know how to use a T-table to find a common expression for the number of characters to print on successive lines, so that you can solve a similar problem.

SpaceNeedle Output.txt 
Your Space Needle program should print out 10 Space Needles.
The output should look EXACTLY like it does in the document above.
main() should look something like this:
    public static void main(String[] args) {
        for (int i = 1; i <= 10; i++) {
            SIZE = i;
            spaceNeedle();
            System.out.println();
            System.out.println();
        }
    }

Ch 3 Exam: printSquare(int)
The 5 methods build towards a fully functional version of print square.
Due: FridaySeptember 9
Drawing a Grid grid.java
grid.java contains the common framework in Ch3G projects 1, 3, 5, pp.222-224 (BJP 2nd Edition).
Here's a slow motion demo showing how the grid code works:
grid1.java

 

Chapter 3G source file: DrawingPanel.java

Drawing a Grid grid.java (time lapse), Grid.java (working code)
grid.java contains the common framework in Ch3G projects 1, 3, 5, pp.222-224 (BJP 2nd Edition).
1. Don't worry about Thread.sleep() or the Interrupt code.
2. What happens when you comment out the 3 indicated lines in grid.java, just one at a time?  Doing this should help you understand how those lines function in the code.

Drawing concentric circles: concentric.java
1. Don't worry about Thread.sleep() or the Interrupt code.
2. What happens when you comment out the 4 indicated lines in concentric.java, just one at a time?  Doing this should help you understand how those lines function in the code.

 

DoublesEqual.java
Complete the body for the method
doublesEffectivelyEqual(double n1, double n2)
This exercise deals with computer roundoff error. (pp. 250-253 BJP 2nd ed.)
Hand in a written page with your solution.
On your page, discuss:
(1) why roundoff error occurs; and
(2) the advantages and disadvantages of your solution.
(3) why the solution "works", depending upon the accuracy you build into it...