Inner and Anonymous Classes Though you are captive in the OO paradigm, you can use inner classes and anonymous classes to get around this constraint and.

Slides:



Advertisements
Similar presentations
Chip amount matches bet amount – Deal button near chips – Clear Button.
Advertisements

Card Counting Driller By Oscar Chen For CS491A. Practice your Card Counting Skills Application to allow Blackjack Enthusiasts to sharpen their skills.
SOCiable A Game of Life Chances ©Jon Witt Version 1.0.
By: Jonathan Quenzer. To have a computer learn how to play Blackjack through reinforcement learning Computer starts off with no memory. After each hand.
Topics in Python Blackjack & TKinter
© Glenn Rowe AC Lab 2 A simple card game (twenty- one)
OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Overview of Data Structures and Algorithms
Lecture 10. Simplified roulette European roulette has numbers 0,1,…36. xD0s
Dealer Comm Hand Player makes Ante bet and optional Bonus bet. Five cards are dealt to each player from the shuffler. Five cards are dealt from the shuffler.
Card Counting What is it, how does it work, and can I use it to pay for college? (and if it does work, do I even have to go to college?) Jeff O’Connell.
BLACKJACK SHARKS: Aabida Mayet, Omar Bacerra, Eser Kaptan March 15, 2010.
An application of the Probability Theory
12 Pontoon1May Pontoon program CE : Fundamental Programming Techniques.
Computer Science 313 – Advanced Programming Topics.
Design Example. Requirements Make a program that simulates the game of blackjack For now, we ignore money/betting…. just simulate game play But… this.
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
Intro to Probability & Games
Chapter 5 Black Jack. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 5-2 Chapter Objectives Provide a case study example from problem statement.
Black Jack Dr. Bernard Chen University of Central Arkansas Spring 2012.
Blackjack: A Beatable Game
1 TCSS 360, Spring 2005 Lecture Notes Design Phase and UML Class Diagrams Relevant Reading: UML Distilled, Third Edition M. Fowler.
Blackjack: Myths vs. Reality Group K Andrew KerrAndrew Phillips Sven SkoogWoj Wrona.
Permutations and Combinations
April 2009 BEATING BLACKJACK CARD COUNTING FEASIBILITY ANALYSIS THROUGH SIMULATION.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented Design.
Creating a class. Fields (instance variables) Fields are the data defined in the class and belonging to each instantiation (object). Fields can change.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
Black Jack MVC By Jeremy DiPaolo. Introduction Goal: To create a Black Jack game that takes advantage of the MVC framework. Uses many of the components.
Casinos There’s a reason they are big and extravagant!
1 Introduction to Discrete Probability Rosen, Section 6.1 Based on slides by Aaron Bloomfield and …
Learning to Play Blackjack Thomas Boyett Presentation for CAP 4630 Teacher: Dr. Eggen.
Paigow Training Hai J Shen International Association of Certified Surveillance Professionals.
Week 4 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Mr C Johnston ICT Teacher BTEC IT Unit 06 - Lesson 01 Introduction to Computer Programming.
Blackjack: A Beatable Game Amber Guo Adapted from: David Parker Advisor: Dr. Wyels California Lutheran University ‘05.
Catch the Spirit of Mathematical Practices Mathematics Investigations Q-Cards: Rational Numbers The Q-Card game has 8 starter cards, 28 playing cards,
"If I can't picture it, I can't understand it.". Reference anonymous - gravity Concrete classes: rules of.
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
Exceptions: Checked versus Unchecked Exceptions.
Object-Oriented Programming (OOP) CSC-2071 (3+1=4 Credits) Lecture No. 1 MBY.
Learning to Play KardKuro Goals: Have Fun while Practicing Addition and Subtraction. Improve Social Learning Opportunities with Classmates. Become familiar.
Blackjack Betting and Playing Strategies: A Statistical Comparison By Jared Luffman MSIM /3/2007.
Casino Craps by Vera Sanchez
Chapter 2 Introducing Interfaces Summary prepared by Kirk Scott.
Creating a class. Fields (instance variables) Fields are the data defined in the class and belonging to each instantiation (object). Fields can change.
Week 4 Introduction to Computer Science and Object-Oriented Programming COMP 111 George Basham.
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
CMSC 202 A Design Exercise. 2 OO design activities Finding the Objects Defining the responsibilities –Services –Attributes Discovering relationships.
GamblingGambling What are the odds? Jessica Judd.
Lec 06 Agenda 1/ the 8 rules of Java 2/ Casting primitives 3/ Swing and Threading 4/ Java Event Model. Event api and support for Swing 5/ Swing labs, live.
Agenda Lec05 Exceptions API Reference- and Type-Anonymity Swing Review.
Object Oriented Programming Object and Classes Lecture 3 MBY.
Gambling and probability 1. Odds and football.  Predict the Premier League results for this weekend.  Can you estimate the probability of a win/draw/loss.
JokerStars: Online Card Playing William Sanville Milestone 5.
Agenda Lec05 Exceptions API
Lec 06 Agenda 1/ the 6 rules of Java
Lecture 11.
Chapter 11 Object-Oriented Design
Chapter 5 Black Jack.
Lecture 10.
Probability of casino games
Truth tables: Ways to organize results of Boolean expressions.
Truth tables: Ways to organize results of Boolean expressions.
Quizz Results hw1 quizz mean std-dev
Truth tables: Ways to organize results of Boolean expressions.
Task 2 Implementation help
Elipses int... passed into method as int[]
Presentation transcript:

Inner and Anonymous Classes Though you are captive in the OO paradigm, you can use inner classes and anonymous classes to get around this constraint and write procedural-like code. Often times, no one but the enclosing class cares about an object. In this case, you may consider using inner or anonymous classes.

Intro to Data Structures in Java Single Lined List Stack Binary Tree others...

WindowsBuilderPro by Google WB/release/R /3.7/ b,y,c,n,s,l,d,f,str; get rid of these in Window || Preferences || Java || Code Style || Fields. Otherwise, they will hose you in WB.

Constructors Constructors are optional. If your class is just a static driver; i.e. it just has a static main method, then no need to instantiate it; and no need for constructor. If your class is a "java bean" -- a class that models a real world object (noun) in your system, then it should have a constructor. House, Car, Person, etc. If you don't provide a constructor, a no-args constructor is provided automatically. You can, and often want, more than one constructor with different signatures. You call a constrcutor with the 'new' keyword.

Model a system Object-oriented programming is about modelling a system. Write the problem out as requirements -- this will essentially be a math world problem (your favorite kind to solve!) Your computer objects map directly to real- world objects (nouns). Your methods map directly to real-world actions (verbs).

Write a very simple application for a contact manager. The the sake of simplicity, each contact will have a name and a phone number only. The user should be able to create new contacts and diplay all contacts. Build a GUI using WindowBuilder and Swing.

Write a very simple application for computer dictionary. The the sake of simplicity, each entry has a word and a definition. Store the pair in an ArrayList. Each DictEntry has two strings. Build a GUI using WindowBuilder and Swing.

Describe the system: The game of BlackJack; a single player plays against the house for money. His bet is consistently $ and he starts with 1, There is a shoe of six 52-card decks which is reshuffled when the shoe is half used. If the player wins the hand, his gets his bet back plus the amount of the bet. If he loses, he loses the money, and if he gets blackjack, he get's his bet * 1.5. The player plays against a dealer who must follow the following strict rules; aces are worth 11points only, and the dealer must hit on 16 or below. The player however, is allowed to hit or hold on any hand-value. Furthermore, aces are worth either 1 or 11, whichever is more advantageous. An initial two hands are dealt on seperate sides of a table consisting of two cards apiece. The dealer's hand displays only one card up. The player has the option to hit, hold, split, double-down, buy insurance, etc. For this initial version of the game, we'll consider only hit, hold, and deal. blue are nouns (objects or fields) red are verbs (methods)

Interfaces A class implements an interface rather than extends it. Any class that implements the interface must override all the interface methods with it's own methods. Interface names often end with "able" to imply that they add to the capabilty of the class. An interface is a contract; it defines the methods