Difference between revisions of "IB Computer Science 1"

From WLCS
(34 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Tuesday (4/17/18) ==
+
== Tuesday - Thursday (6/5/18 - 6/7/18) ==
 +
'''Agenda:'''
 +
* Demo any missing assignments (e.g. Brick class, Brick collision, etc.)
 +
* [[IBCS2 Summer Assignment]]
 +
 
 +
== Friday (6/1/18) ==
 +
'''Agenda:'''
 +
* TURN IN FINAL EXAM EXEMPTION SLIPS!
 +
* Demo Brick assignment (row of flashing bricks using the test main code below)
 +
* Brick collision assignment
 +
*# Now that you have Bricks that can display, implement the following methods in the Brick class:
 +
*#* boolean hitTop(Ball b) - returns true if the Ball b's bottom edge hits the top side of a '''visible''' Brick (i.e. check for visibility too); return false otherwise (HINT: You basically have this method already done...)
 +
*#* boolean hitBottom(Ball b) - returns true if the Ball b's '''top''' edge hits the '''bottom''' side of a '''visible''' Brick (i.e. check for visibility too)
 +
*#* boolean hitLeft(Ball b) - returns true if the Ball b's '''right''' edge his the '''left''' side of a '''visible''' Brick (i.e. check for visibility too)
 +
*#* boolean hitRight(Ball b) - returns true if the Ball b's '''left''' edge his the '''right''' side of a '''visible''' Brick (i.e. check for visibility too)
 +
*# To demonstrate this assignment, modify the Brick test code that was given to you, so that the row of Bricks no longer blink.  Instead, add if-statements to check if the ball hits the top OR bottom of a '''visible''' Brick, then turn the Brick invisible and reverse the ball's dy.  If the ball hits the left or right of a '''visible''' Brick, then turn the Brick invisible and reverse the ball's dx.
 +
 
 +
== Wednesday (5/30/18) ==
 +
'''Agenda:'''
 +
* Brick assignment
 +
** Design and implement a Brick class
 +
** Instance variables:
 +
*** int x
 +
*** int y
 +
*** int w
 +
*** int h
 +
*** color c //we will go over this in class
 +
*** boolean visible
 +
** Methods:
 +
*** Brick() //constructor - sets all the instance variables to appropriate values
 +
*** Brick(int x, int y, int w, int h, color c) //specific constructor - we will learn about this
 +
*** display() //displays the brick if it is visible (true)
 +
*** setVisible(boolean v) //set the visible instance variable to v
 +
* Demo your Brick in a new sketch using the main code below:
 +
 
 +
<syntaxhighlight lang="java">
 +
Brick b0;
 +
Brick b1;
 +
Brick b2;
 +
Brick b3;
 +
Brick b4;
 +
int time = millis();
 +
 
 +
void setup()
 +
{
 +
  size(600, 600);
 +
  b0 = new Brick(50, height/2, 100, 25, color(255, 0, 0));
 +
  b1 = new Brick(150, height/2, 100, 25, color(128, 128, 0));
 +
  b2 = new Brick(250, height/2, 100, 25, color(128, 128, 128));
 +
  b3 = new Brick(350, height/2, 100, 25, color(0, 255, 0));
 +
  b4 = new Brick(450, height/2, 100, 25, color(0, 255, 255));
 +
  time = millis();
 +
}
 +
 
 +
void draw()
 +
{
 +
  background(0);
 +
  b0.display();
 +
  b1.display();
 +
  b2.display();
 +
  b3.display();
 +
  b4.display();
 +
  if (millis() - time > 500)
 +
  {
 +
    b0.setVisible(false);
 +
    b1.setVisible(false);
 +
    b2.setVisible(false);
 +
    b3.setVisible(false);
 +
    b4.setVisible(false);
 +
  }
 +
  if(millis() - time > 1000)
 +
  {
 +
    time = millis();
 +
    b0.setVisible(true);
 +
    b1.setVisible(true);
 +
    b2.setVisible(true);
 +
    b3.setVisible(true);
 +
    b4.setVisible(true);
 +
  }
 +
}
 +
</syntaxhighlight>
 +
 
 +
== Wednesday - Friday (5/23/18 - 5/24/18) ==
 +
'''Agenda:'''
 +
* Please complete [https://goo.gl/forms/h8F8tZOqxwxG4Wxj2 Mr. Bui's End of Course Survey]
 +
* Surprise!
 +
** Extra credit if...
 +
* Finish Paddle hitTop() walk through
 +
* Demonstrate and missing assignments
 +
* Design and implement a Brick class
 +
** What attributes would a Brick have?
 +
** What methods would a Brick have?
 +
 
 +
== Thursday (5/17/18) ==
 +
'''Warmup:'''
 +
* Implement the following methods in the Paddle class:
 +
** void moveLeft() - adjust the Paddle's x variable appropriately using dx
 +
** void moveRight() - adjust the Paddle's x variable appropriately using dx
 +
** void moveUp() - adjust the Paddle's y variable appropriately using dy
 +
** void moveDown() - adjust the Paddle's y variable appropriately using dy
 +
* Test out your methods by calling them using the keyboard in the main tab
 +
 
 +
'''Agenda:'''
 +
* Classes and objects review
 +
* Paddle hitTop() walk through
 +
 
 +
== Tuesday (5/15/18) ==
 +
'''Agenda:'''
 +
* If you were not here last class, please watch the linked video about Xerox PARC at home
 +
** [https://www.youtube.com/watch?v=ZFUsYXZSMqs Xerox PARC, Apple, & Microsoft history]
 +
* Introduction Object-Oriented Programming
 +
** Ball class review
 +
** Complete and integrate the Paddle class.  Demo this for credit
 +
** Create a new method in the Paddle class:
 +
*** boolean hitTop(Ball b) - returns true if b collides with the top edge of the Paddle (we will discuss this more, but you can try to do it yourself).  Return false otherwise
 +
 
 +
== Wednesday - Friday (5/9/18 - 5/11/18) ==
 +
'''Agenda:'''
 +
* Demo converted List Exercises
 +
* [https://www.youtube.com/watch?v=ZFUsYXZSMqs Xerox PARC, Apple, & Microsoft history]
 +
* Processing Java arrays and bouncing ball
 +
* Introduction to Java classes and objects
 +
** [https://processing.org/tutorials/objects/ Processing - Objects Tutorial]
 +
** Define a Paddle class with the following instance variables and methods:
 +
*** Instance variables (attributes):
 +
**** int x
 +
**** int y
 +
**** int w
 +
**** int h
 +
*** Methods
 +
**** Paddle() //constructor
 +
**** display() //draws a rectangle using the Paddle's instance variables
 +
**** moveMouse() //sets the x and y instance variables using the mouseX and mouseY variables
 +
** Add a Paddle to your program
 +
 
 +
== Monday (5/7/18) ==
 +
'''Agenda:'''
 +
* No Internet
 +
* Convert your [[Advanced Python List Exercises]] to use Java arrays
 +
** We will walked through the first two examples last class
 +
** Convert and be prepared to demo List Min/Max and Reverse
 +
 
 +
== Tuesday - Thursday (5/1/18 - 5/3/18) ==
 +
'''Agenda:'''
 +
* [https://survey.k12insight.com/r/CvhCPg CTE Program Completer Survey]
 +
* Convert any looped program to use a for loop (Prime, Monte Carlo, Taylor Series, etc.)
 +
** Demo your program
 +
* Java arrays [lists]
 +
** [[Media:JavaArrays Basic.ppt]]
 +
** Convert your [[Advanced Python List Exercises]] to use Java arrays
 +
** We will walk through the first two examples
 +
 
 +
== Friday (4/27/18) ==
 +
'''Agenda:'''
 +
* Demo any missing assignments:
 +
** Prime numbers assignment
 +
** Monte Carlo Pi assignment
 +
** Taylor Series Pi and e assignment
 +
** Functions/Methods Practice assignment
 +
* Java for loop
 +
** [https://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html Oracle Documentation - The for Statement]
 +
** Practice for loops
 +
 
 +
== Monday - Wednesday (4/23/18 - 4/25/18) ==
 +
'''Agenda:'''
 +
* Demo the following converted programs:
 +
** Prime numbers assignment
 +
** Monte Carlo Pi assignment
 +
** Taylor Series Pi and e assignment
 +
* Java functions / methods
 +
* Convert the [[Python Functions Assignment]] to Java methods
 +
** Class walk-through first couple functions/methods
 +
 
 +
== Tuesday - Thursday (4/17/18 - 4/19/18) ==
 
'''Agenda:'''
 
'''Agenda:'''
 
* Nested-if statements review
 
* Nested-if statements review
Line 6: Line 179:
 
* Convert Guessing Game assignment from Python -> Java
 
* Convert Guessing Game assignment from Python -> Java
 
** Class walk-through
 
** Class walk-through
 +
* Integer division and casting
 
* Convert Prime numbers assignment from Python -> Java
 
* Convert Prime numbers assignment from Python -> Java
 
* Convert Monte Carlo Pi assignment from Python -> Java
 
* Convert Monte Carlo Pi assignment from Python -> Java

Revision as of 06:23, 7 June 2018

Tuesday - Thursday (6/5/18 - 6/7/18)

Agenda:

Friday (6/1/18)

Agenda:

  • TURN IN FINAL EXAM EXEMPTION SLIPS!
  • Demo Brick assignment (row of flashing bricks using the test main code below)
  • Brick collision assignment
    1. Now that you have Bricks that can display, implement the following methods in the Brick class:
      • boolean hitTop(Ball b) - returns true if the Ball b's bottom edge hits the top side of a visible Brick (i.e. check for visibility too); return false otherwise (HINT: You basically have this method already done...)
      • boolean hitBottom(Ball b) - returns true if the Ball b's top edge hits the bottom side of a visible Brick (i.e. check for visibility too)
      • boolean hitLeft(Ball b) - returns true if the Ball b's right edge his the left side of a visible Brick (i.e. check for visibility too)
      • boolean hitRight(Ball b) - returns true if the Ball b's left edge his the right side of a visible Brick (i.e. check for visibility too)
    2. To demonstrate this assignment, modify the Brick test code that was given to you, so that the row of Bricks no longer blink. Instead, add if-statements to check if the ball hits the top OR bottom of a visible Brick, then turn the Brick invisible and reverse the ball's dy. If the ball hits the left or right of a visible Brick, then turn the Brick invisible and reverse the ball's dx.

Wednesday (5/30/18)

Agenda:

  • Brick assignment
    • Design and implement a Brick class
    • Instance variables:
      • int x
      • int y
      • int w
      • int h
      • color c //we will go over this in class
      • boolean visible
    • Methods:
      • Brick() //constructor - sets all the instance variables to appropriate values
      • Brick(int x, int y, int w, int h, color c) //specific constructor - we will learn about this
      • display() //displays the brick if it is visible (true)
      • setVisible(boolean v) //set the visible instance variable to v
  • Demo your Brick in a new sketch using the main code below:
Brick b0;
Brick b1;
Brick b2;
Brick b3;
Brick b4;
int time = millis();

void setup()
{
  size(600, 600);
  b0 = new Brick(50, height/2, 100, 25, color(255, 0, 0));
  b1 = new Brick(150, height/2, 100, 25, color(128, 128, 0));
  b2 = new Brick(250, height/2, 100, 25, color(128, 128, 128));
  b3 = new Brick(350, height/2, 100, 25, color(0, 255, 0));
  b4 = new Brick(450, height/2, 100, 25, color(0, 255, 255));
  time = millis();
}

void draw()
{
  background(0);
  b0.display();
  b1.display();
  b2.display();
  b3.display();
  b4.display();
  if (millis() - time > 500)
  {
    b0.setVisible(false);
    b1.setVisible(false);
    b2.setVisible(false);
    b3.setVisible(false);
    b4.setVisible(false);
  }
  if(millis() - time > 1000)
  {
    time = millis();
    b0.setVisible(true);
    b1.setVisible(true);
    b2.setVisible(true);
    b3.setVisible(true);
    b4.setVisible(true);
  }
}

Wednesday - Friday (5/23/18 - 5/24/18)

Agenda:

  • Please complete Mr. Bui's End of Course Survey
  • Surprise!
    • Extra credit if...
  • Finish Paddle hitTop() walk through
  • Demonstrate and missing assignments
  • Design and implement a Brick class
    • What attributes would a Brick have?
    • What methods would a Brick have?

Thursday (5/17/18)

Warmup:

  • Implement the following methods in the Paddle class:
    • void moveLeft() - adjust the Paddle's x variable appropriately using dx
    • void moveRight() - adjust the Paddle's x variable appropriately using dx
    • void moveUp() - adjust the Paddle's y variable appropriately using dy
    • void moveDown() - adjust the Paddle's y variable appropriately using dy
  • Test out your methods by calling them using the keyboard in the main tab

Agenda:

  • Classes and objects review
  • Paddle hitTop() walk through

Tuesday (5/15/18)

Agenda:

  • If you were not here last class, please watch the linked video about Xerox PARC at home
  • Introduction Object-Oriented Programming
    • Ball class review
    • Complete and integrate the Paddle class. Demo this for credit
    • Create a new method in the Paddle class:
      • boolean hitTop(Ball b) - returns true if b collides with the top edge of the Paddle (we will discuss this more, but you can try to do it yourself). Return false otherwise

Wednesday - Friday (5/9/18 - 5/11/18)

Agenda:

  • Demo converted List Exercises
  • Xerox PARC, Apple, & Microsoft history
  • Processing Java arrays and bouncing ball
  • Introduction to Java classes and objects
    • Processing - Objects Tutorial
    • Define a Paddle class with the following instance variables and methods:
      • Instance variables (attributes):
        • int x
        • int y
        • int w
        • int h
      • Methods
        • Paddle() //constructor
        • display() //draws a rectangle using the Paddle's instance variables
        • moveMouse() //sets the x and y instance variables using the mouseX and mouseY variables
    • Add a Paddle to your program

Monday (5/7/18)

Agenda:

  • No Internet
  • Convert your Advanced Python List Exercises to use Java arrays
    • We will walked through the first two examples last class
    • Convert and be prepared to demo List Min/Max and Reverse

Tuesday - Thursday (5/1/18 - 5/3/18)

Agenda:

Friday (4/27/18)

Agenda:

  • Demo any missing assignments:
    • Prime numbers assignment
    • Monte Carlo Pi assignment
    • Taylor Series Pi and e assignment
    • Functions/Methods Practice assignment
  • Java for loop

Monday - Wednesday (4/23/18 - 4/25/18)

Agenda:

  • Demo the following converted programs:
    • Prime numbers assignment
    • Monte Carlo Pi assignment
    • Taylor Series Pi and e assignment
  • Java functions / methods
  • Convert the Python Functions Assignment to Java methods
    • Class walk-through first couple functions/methods

Tuesday - Thursday (4/17/18 - 4/19/18)

Agenda:

  • Nested-if statements review
  • Java while loops
  • Java random numbers
  • Convert Guessing Game assignment from Python -> Java
    • Class walk-through
  • Integer division and casting
  • Convert Prime numbers assignment from Python -> Java
  • Convert Monte Carlo Pi assignment from Python -> Java
  • Convert Taylor Series Pi and e assignment from Python -> Java

Friday (4/13/18)

Agenda:

Wednesday (4/11/18)

Agenda:

Friday (4/6/18)

Agenda:

  • Demo any Java assignments
  • End of 3rd Quarter
  • Review Java Strings

Wednesday (4/4/18)

Agenda:

  • Mr. Bui is still out because his son has the flu
  • Read through Media:JavaStrings_Basic.pptx
    • Be sure to test some of the Java code out
  • Convert your Tech Support Flow Chart Assignment from Python -> Java
    • You will need to use the Scanner's nextLine() method to take input as a String
    • You will need to use the String's equals() method to compare if two Strings match
String str1 = "hello";
String str2 = "goodbye";

if(str1.equals("hello"))
{
    System.out.println("This will print because the condition is true");
}

if(str2.equals("hello"))
{
    System.out.println("This does not print because the condition is false");
}

Monday (4/2/18)

Agenda:

  • Mr. Bui is out today because his son is sick.
  • Take a few minutes and review your Python->Java notes
  • Go back and convert the following from Python -> Java (if you do not have the Python code, then simply get a copy from somebody else in the class)
    • Quadratic Formula
    • Letter Grade Calculator
  • Demonstrating the Java versions of Quadratic Formula and the Letter Grade Calculator will be counted in the 3rd quarter.

Archives