Computer Science 15-110 (Lecture 4), Spring 2010
Quiz #1, part 1
Taken in recitation #2 (Fri 22-Jan-10)

* You have 8 minutes (no extensions for latecomers)
* Write your answers by hand on a separate sheet of paper.
* No calculators, books, computers, etc.
* Assume "page" and "scanner" are already defined and initialized in the usual way.
*
Show your work

  1. What will this program print?  Show your work.

      public static void main(String[] args) {
        int x = 45, y = 52, z = 33;
        System.out.println((x/y) + "," + (y/x));
        System.out.println((x%y) + "," + (y%x));
        System.out.println(10 * z - x / 10);
      }

     
  2. Write a few lines of code that read in two numbers, the width and height of a rectangle, and print the perimeter (not the area) of the rectangle.
     
  3. Write a few lines of code that paint a blue circle with radius 50 that stays centered inside the window at all times.