IB Computer Science 2

From WLCS
Revision as of 12:32, 1 November 2018 by Admin (talk | contribs)

Thursday (11/1/18)

Agenda:

  • Turn in Group 4 Project Permission slip
  • Turn in Dual Enrollment form
  • Complete Poker Hand Methods w/ arrays
    • NOTE: If you want to check if two strings match (e.g. String s and String s2) you must use s.equals(s2)
  • Create your own test cases...try to use multiple test per method
  • Here is a list of cards and the integer values to create them

Tuesday (10/30/18)

Agenda:

  • Turn in Group 4 Project Permission slip
  • Turn in Dual Enrollment form
  • Create a demonstration program for your sort() and shuffle() methods
  • Poker Hand Methods w/ arrays
    • int getHighCardValue(Card[] cards)
      • returns the value of the highest Card (Hint: Use find maximum algorithm)
    • boolean checkPair(Card[] cards)
      • returns true if any two Cards have the same value, false otherwise
      • You may want to sort the cards before you look for a pair of matching cards
    • boolean checkTwoPair(Card[] cards)
      • returns true if there are two pairs of Cards have the same value, false otherwise
      • You may want to sort the cards before you look for two pair
    • boolean checkThreeOfAKind(Card[] cards)
      • returns true if there are three Cards have the same value, false otherwise
      • You may want to sort the cards before you look for three of a kind
    • Continue implementing boolean check methods for the other poker hands:
      • straight, flush, full house, four of a kind, straight flush, royal flush
      • Hint: You can actually use some method calls to the other methods in several of the method definitions (e.g. You can call checkStraight() and checkFlush() to make checkStraightFlush() easier)

Friday (10/26/18)

Warmup:

  • Group 4 Project permission slips!
  • Check if you have NetBeans and JGrasp installed...we will be starting to use them more
  • Complete Card class lab assignment (tests can be found via repl.it)

Agenda:

  • Class Construction Quiz
  • Intro Poker Hand Methods
    • int getHighCardValue(Card c0, Card c1, Card c2, Card, c3, Card c4)
      • returns the value of the highest Card
    • Do not continue with the other poker hand methods like above b/c we will be making new versions using arrays!
  • Introduction to Arrays of Objects
    • Walkthrough -- take notes! Pay attention!
  • Basic Card[] methods - implement the following, test, and demo for credit
    • void printCards(Card[] cards) - we will do this one together
      • Use a for loop to iterate through all the cards, and print them to the screen
    • void shuffle(Card[] cards)
      1. Write a for loop that runs a bunch of times (e.g. 10000)
      2. Generate two random numbers from 0 to the length of cards
      3. Swap the cards at the locations of the two random numbers
    • void sort(Card[] cards)
      • Implement either selection sort or bubble sort to sort your Card[] array. You can literally copy and paste your sorting code from before, and then tweak it to use the value of the cards (i.e. getValue())
      • You should be able to test your code by generating a bunch of cards, sorting it, and then printing it out. They should display in order of value.

Homework:

  • Implement the sort() and shuffle() methods for Card[]

Wednesday (10/24/18)

Agenda:

  • Make sure you've completed all the class construction assignments in Repl.it
  • Make sure you've installed NetBeans
  • Card class lab assignment
  • We will create poker hand methods to determine whether or not a Card[5] array contains a particular poker hand
  • Quiz on Friday on class construction
    • How do you study for this quiz? Do all the class construction homework...duh

Monday (10/22/18)

Agenda:

Thursday (10/18/18)

Agenda:

  • Go to your App Catalog and look for NetBeans -- is it there?
  • Demo Mosaic and Pointilism assignment(s) today
  • Java Objects Slides
  • Point class assignment - complete in NetBeans or repl.it (*must* submit to repl.it for auto-testing)
    1. You will create two java files: Point.java and Main.java
      • Point.java - the Point class definition will be here
      • Main.java - only the main() method will be located here
    2. Declare and initialize the following private attributes in the Point class
      • double x = 0.0
      • double y = 0.0
    3. Define two Point() constructors:
      • default constructor: Point()
      • specific constructor Point(double newX, double newY)
    4. Define the following public methods in the Point class
      • double getX() - returns the x-coordinate
      • double getY() - returns the y-coordinate
      • void setX(double newX) - sets the x-coordinate to the new x-coordinate parameter
      • void setY(double newY) - sets the y-coordinate to the new y-coordinate parameter
      • String toString() - returns a String representation of the Point object
    5. Go to your Main.java file to test out your Point class
    6. In the main method, create several new instances of Point objects
    7. Print out each of your Point objects
    8. Define a static method in Main.java named double slope(Point p1, Point p2) - returns the slope between p1 and p2
    9. Test and print out your slope method when you use it with your instantiated Point objects in the main() method
  • More Java class assignments - complete in NetBeans or repl.it (*must* submit to repl.it for auto-testing)

Tuesday (10/16/18)

Agenda:

  • Creating a blank image and manipulating the pixels
    1. Rotate 90 degrees clockwise
  • Complete and demo the following image processing assignments:
    1. Rotate 90 degrees clockwise of a non-square image (no animation needed)
    2. Mosaic (no animation needed)
      1. Take an image, sample every (10th row, 10th col) pixel's color
      2. Draw a 10x10 square using the sampled pixel's color at ever 10th (x,y)
      3. You should display both the original image and its mosaic
    3. Pointilism Animation
      1. This will be an animation
      2. Within setup(), load an image, load its pixels, and turn off line strokes
      3. Within draw(), generate a random index number from 0 to image's pixel length (use random())
        • int rand = (int) random(0, img.pixels.length);
      4. Sample the color of the pixel from the random index and fill with the color
      5. Calculate the appropriate (x,y) from the random index (Hint: use modulus (%) for x and division (/) for y)
      6. Draw the circle at its appropriate (x,y) using a random diameter from (5, 15)

Homework:

  • All of the image processing assignments are due Thursday (10/18/18)

Tuesday - Friday (10/9/18 - 10/12/18)

Agenda:

  • Demo Media:BubbleSort.java
  • Algorithms Identification Quiz in Canvas
  • Reference variables overview
  • Two-Dimensional Arrays and Nested Loops
    1. Accessing all of the individual elements of a two-dimensional list
    2. Prompt the user to construct a two-dimensional list
      1. Prompt for the number of rows
      2. Prompt for the number of columns
      3. Prompt the user for each number in the two-dimensional list
    3. Write a method: void matrixPrint(int[][] m)
      • Print each row on a separate line, and each element should be separated by a space
      • Complete the method in repl.it
  • Nested Loops, Processing & Images
    • Processing coordinate system review (print mouse coordinates)
    • Processing PImage object practice
    • Processing: Images & Pixels Tutorial
    • As a class, we'll walk through several of the examples from the tutorial above, and we'll modify each slightly
  • Image Processing Exercises?
    1. Convert to black and white
    2. Rotate image 90 degrees
    3. Flip vertical
    4. Flip horizontal
    5. Pointilism
    6. Mosaic
    7. Edge detection?

Homework Challenge:

  • Try to complete the rotate 90 degrees image challenge

Thursday (10/4/18)

Agenda:

  • Make sure you've completed Selection Sort in repl.it
    • Mr. Bui will be manually looking at your repl.it submissions too
  • Take the Sorting Identification Quiz in Canvas
    • The access code is ...
  • Bubble sort review
  • Complete and demo Media:BubbleSort.java

Tuesday (10/2/18)

Warmup:

  • Take the Abstract Data Structures Pre-assessment on Canvas
    • Do not guess answers, skip them if you do not know the answer
  • Complete the Find Minimum & Maximum repl.it

Agenda:

  • Group sorting activity
    1. Form 3-4 person groups
    2. Receive playing cards
    3. With your group, document an algorithm (steps) of how you sort the cards out
  • Introduction to Sorting
  • Selection sort assignment in repl.it

Archives