Difference between revisions of "IB Computer Science 2"
From WLCS
Line 10: | Line 10: | ||
** Do not continue with the other poker hand methods like above b/c we will be making new versions using arrays! | ** Do not continue with the other poker hand methods like above b/c we will be making new versions using arrays! | ||
** int HighCard(Card[] hand) - returns the value of the highest Card (Hint: Use find max algorithm) | ** int HighCard(Card[] hand) - returns the value of the highest Card (Hint: Use find max algorithm) | ||
− | ** boolean | + | ** boolean Pair(Card[] hand) - returns true if any two Cards have the same value, false otherwise |
+ | ** boolean TwoPair(Card[] hand) - returns true if there are two pairs of Cards have the same value, false otherwise (Hint: You can actually use Pair() to help you) | ||
== Wednesday (10/24/18) == | == Wednesday (10/24/18) == |
Revision as of 09:45, 26 October 2018
Contents
Friday (10/26/18)
Warmup:
- Check if you have NetBeans and JGrasp installed...we will be starting to use them more
Agenda:
- Class Construction Quiz
- Complete Card class lab assignment (tests can be found via repl.it)
- Intro Poker Hand Methods
- int HighCard(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!
- int HighCard(Card[] hand) - returns the value of the highest Card (Hint: Use find max algorithm)
- boolean Pair(Card[] hand) - returns true if any two Cards have the same value, false otherwise
- boolean TwoPair(Card[] hand) - returns true if there are two pairs of Cards have the same value, false otherwise (Hint: You can actually use Pair() to help you)
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:
- Complete Point class assignment in repl.it
- Car class lab assignment - submit for testing in repl.it
- Vector class lab assignment - submit for testing in repl.it
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)
- 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
- Declare and initialize the following private attributes in the Point class
- double x = 0.0
- double y = 0.0
- Define two Point() constructors:
- default constructor: Point()
- specific constructor Point(double newX, double newY)
- 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
- Go to your Main.java file to test out your Point class
- In the main method, create several new instances of Point objects
- Print out each of your Point objects
- Define a static method in Main.java named double slope(Point p1, Point p2) - returns the slope between p1 and p2
- Test and print out your slope method when you use it with your instantiated Point objects in the main() method
- You will create two java files: Point.java and Main.java
- More Java class assignments - complete in NetBeans or repl.it (*must* submit to repl.it for auto-testing)
- Mr. Bui is still in the process of creating the repl.it test cases
- Car class lab assignment
- Vector class lab assignment
Tuesday (10/16/18)
Agenda:
- Creating a blank image and manipulating the pixels
- Rotate 90 degrees clockwise
- Complete and demo the following image processing assignments:
- Rotate 90 degrees clockwise of a non-square image (no animation needed)
- Mosaic (no animation needed)
- Take an image, sample every (10th row, 10th col) pixel's color
- Draw a 10x10 square using the sampled pixel's color at ever 10th (x,y)
- You should display both the original image and its mosaic
- Pointilism Animation
- This will be an animation
- Within setup(), load an image, load its pixels, and turn off line strokes
- Within draw(), generate a random index number from 0 to image's pixel length (use random())
- int rand = (int) random(0, img.pixels.length);
- Sample the color of the pixel from the random index and fill with the color
- Calculate the appropriate (x,y) from the random index (Hint: use modulus (%) for x and division (/) for y)
- 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
- Accessing all of the individual elements of a two-dimensional list
- Prompt the user to construct a two-dimensional list
- Prompt for the number of rows
- Prompt for the number of columns
- Prompt the user for each number in the two-dimensional list
- 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?
- Convert to black and white
- Rotate image 90 degrees
- Flip vertical
- Flip horizontal
- Pointilism
- Mosaic
- 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
- Form 3-4 person groups
- Receive playing cards
- With your group, document an algorithm (steps) of how you sort the cards out
- Introduction to Sorting
- Selection sort assignment in repl.it