CSC103 Final Exam 2017

From dftwiki3
Revision as of 17:50, 17 October 2017 by Thiebaut (talk | contribs)
Jump to: navigation, search

--D. Thiebaut (talk) 22:30, 16 October 2017 (EDT)



This exam is a take-home exam for CSC103, Fall 2017. The exam is open-books, open-notes, and open-Web. It is given under the rules of the Smith College Honor Code, and the work your turn in must reflect your individual work. You cannot discuss any of the details of this exam with anybody except your instructor (Dominique Thiebaut). If you have a question, please post it on Piazza.
You cannot work in pairs on this exam.
This exam is due on Moodle on 25 October 2017 at 11:55 p.m.




...




<onlydft>

Solutions


Problem 3


// CSC103
// Final Exam 
// Smith College
// Script creating a red window 
// with the caption "CSC103 2017"
// 
void setup() {
  // define the size of the window
  size( 400, 600 );
  smooth();
  
  // create red background
  background( 240, 19, 19 );
}

void draw() {
  strokeWeight( 1 );
  if ( mousePressed == true ) {
    if ( mouseY < 300 ) {
      fill( 196, mouseY/2, 219 );
      ellipse( mouseX, mouseY, mouseX/2, mouseX/2 );
    }
    else {
       fill( 211, 122, mouseY/2 );
       rect( mouseX, mouseY, mouseX/4, mouseX/4 );
    }
  }
  
  stroke( 0, 0, 0 );
  strokeWeight( 10 );
  fill(  240, 19, 19 );
  rect( 25, 50, 350, 70 );
  
  textAlign( CENTER );
  textSize( 48 );
  fill( 149, 77, 77 );
  text( "CSC103 2017", 200, 100 );
  
  textSize(24 );
  fill( 0, 0, 0 );
  text( "Mickey Mouse", width/2, height - 30 );
}