Computer Science 15-110, Spring 2010
Recitation for Week #1


  1. Logistics
  2. Installation
  3. CA-Directed Lab
    1. triangleArea
    2. onesDigit
    3. eggCartons
    4. flagOfMali
  4. Student-Directed (Collaborative) Lab
    1. hundredsDigit
    2. flagOfGhana
    3. More Flags (time permitting)

  1. Logistics
    Introductions, Attendance, etc
     
  2. Installation
    Everyone should run Hello World both on their laptops (if they have one) and on the Linux machines in the lab.
     
  3. CA-Directed Lab
    1. triangleArea
      Write a program that reads in 2 non-negative integers, the width and height of a triangle, and prints the area of that triangle (using integer division).  You may assume the input values are non-negative.

      Thought question:  Why won't this work:
          int area = 1/2*width*height;
       
    2. onesDigit
      Write a program that reads in a non-negative integer and prints just the 1's digit of that number.
       
    3. eggCartons
      Write a program that reads in a non-negative number of eggs, and prints the number of egg cartons required to hold that many eggs (given that each egg carton holds one dozen eggs, and you cannot buy fractional egg cartons).  Be sure your program works for multiples of 12, including 0.
       
    4. flagOfMali
      Write a program that displays the flag of Mali.  Your flag can use built-in colors (rather than exactly color-matching with custom colors).  Your flag may not be fixed-sized, but rather it must entirely fill the window, even when the window is resized, and it must not draw outside the window!  While the window's size may change, you may assume the window will be roughly "flag-shaped" -- you will not be graded on how your flags appear in, say, a tall thin window (which is not at all "flag-shaped").  Finally, you are not responsible this week for the "thin white line" problem (which we will discuss in class next week).
             Mali
            
        (larger image with details)
       
  4. Student-Directed (Collaborative) Lab
    1. hundredsDigit
      Write a program that reads in a non-negative integer and prints just the 100's digit of that number.  If the number is less than 100, its 100's digit is 0.
       
    2. flagOfGhana
      Following the guidelines above, write a program that displays the flag of Ghana.  Replace the star with a circle.
             Ghana
          
           (larger image with details)
       
    3. More Flags (time permitting)
      As time permits, draw more flags (replacing stars with circles) from the CIA Flags of the World page.

carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem   -   carpe diem