1 Hour, Closed Notes, Browser open to Java API docs is OK



Similar documents
TEXAS HOLD EM POKER FOR SIGHT

RULES FOR TEXAS HOLD EM POKER

The game of roulette is played by throwing a small ball onto a rotating wheel with thirty seven numbered sectors.

RULES FOR PLAY TEXAS HOLD EM

Texas Hold em No Limit Freeze Poker Tournament

Laboratory work in AI: First steps in Poker Playing Agents and Opponent Modeling

How to Play. Player vs. Dealer

You are to simulate the process by making a record of the balls chosen, in the sequence in which they are chosen. Typical output for a run would be:

GUIs with Swing. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2012

Introduction to ProForm Rapid elearning Studio. What is ProForm? The ProForm Course Authoring Tool allows you to quickly create

Slots seven card stud...22

CS170 Lab 11 Abstract Data Types & Objects

3 Improving the Crab more sophisticated programming

Ultimate Texas Hold'em features head-to-head play against the player/dealer and an optional bonus bet.

LIVE CASINO HOLD EM. Live Casino Hold em five-card poker, world-class quality. As real as it gets BENEFITS AT A GLANCE.

on a table having positions for six players on one side of the table 1. A true to scale rendering and a color photograph of the

qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq

Object of the Game The object of the game is for each player to form a five-card hand that ranks higher than the player-dealer s hand.

FIRST GRADE Number and Number Sense

Casino Gaming Rule 2010

CS193j, Stanford Handout #10 OOP 3

System.out.println("\nEnter Product Number 1-5 (0 to stop and view summary) :

players on one side of the table and a place for the dealer on the opposite side.

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

GAME DESCRIPTION AND RULES HOLD'EM

Term Project: Roulette

WHAT ARE THE ODDS? The Wizard of Odds Analyzes the New Casino Games

Sequence Diagram Tutorial. From: UML Distilled, Third Edition, Chapter 4 M. Fowler

Texas Hold em. From highest to lowest, the possible five card hands in poker are ranked as follows:

Double Deck Blackjack

There are a number of superb online resources as well that provide excellent blackjack information as well. We recommend the following web sites:

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

CSS 543 Program 3: Online Tic-Tac-Toe Game Professor: Munehiro Fukuda Due date: see the syllabus

PLACE BETS (E) win each time a number is thrown and lose if the dice ODDS AND LAYS HARDWAYS (F) BUY & LAY BETS (G&H)

Iteration CHAPTER 6. Topic Summary

The first program: Little Crab

Assignment 1: Matchismo

How to Play Blackjack Alex Powell, Jayden Dodson, Triston Williams, Michael DuVall University of North Texas TECM /27/2014

Eclipse with Mac OSX Getting Started Selecting Your Workspace. Creating a Project.

Special Notice. Rules. Weiss Schwarz Comprehensive Rules ver Last updated: October 15 th Outline of the Game

Fundamentals of Java Programming

2 The first program: Little Crab

The cloth covering a Three Card Poker 6 Card Bonus table (the layout) shall have wagering areas for eight players.

INTRODUCTION TO COMPUTER PROGRAMMING. Richard Pierse. Class 7: Object-Oriented Programming. Introduction

Combinatorics 3 poker hands and Some general probability

BAD BEAT. Bad Beat will reset at $10,000 with a qualifier of four deuces beaten. Every Monday at 6:00 AM the Bad Beat will increase by $10,000.

The game also features three optional bonus bets.

Casino Control (3 Card Poker) Approval 2006 (No 1)

How to Install Java onto your system

1 Bet Threat Texas Hold Em Gaming Equipment Rules of the Games Temporary Amendments: N.J.A.C. 19:40-1.2; and 19: , 1.18 and 1.

Mus is the most popular Spanish game, due to its attractiveness and characteristics. This game was born in Basque Country

Part I. Multiple Choice Questions (2 points each):

Design and UML Class Diagrams

MAKING MATH MORE FUN BRINGS YOU FUN MATH GAME PRINTABLES FOR HOME OR SCHOOL

Effective unit testing with JUnit

Test Driven Development

1. Shuffling Machine: Cards used to play Casino War shall be dealt from an automatic card shuffling device ( shuffler ).

1. General Black Jack Double Deck Black Jack Free Bet Black Jack Craps Craps Free Craps...

NewPokerSoft. Texas Holdem Poker Game Simulator

Threads 1. When writing games you need to do more than one thing at once.

Handout 3 cs180 - Programming Fundamentals Spring 15 Page 1 of 6. Handout 3. Strings and String Class. Input/Output with JOptionPane.

Building Java Programs

GUI Event-Driven Programming

Champion Poker Texas Hold em

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

Sharpen Solutions. 1 Part One. Sometimes there s more than one right answer. And sometimes the

Part 3: GridWorld Classes and Interfaces

Programming Methods & Java Examples

Object Oriented Programming with Java. School of Computer Science University of KwaZulu-Natal

FOUR CARD POKER EXPERIENCEEVERYTHING. 24/7 ACTION SilverReefCasino.com (866)

2016 POKER TOURNAMENT CONTEST RULES

Collusion with another player or any other form of cheating. Creating a disturbance by arguing, shouting, or making excessive noise.

Microsoft Expression Web Quickstart Guide

Standards of play: Type of gaming table utilized for this game:

Online Web Learning University of Massachusetts at Amherst

This Method will show you exactly how you can profit from this specific online casino and beat them at their own game.

Sample CSE8A midterm Multiple Choice (circle one)

Grundlæggende Programmering IT-C, Forår Written exam in Introductory Programming

Implementação. Interfaces Pessoa Máquina 2010/ Salvador Abreu baseado em material Alan Dix. Thursday, June 2, 2011

Welcome to Harcourt Mega Math: The Number Games

Scanner. It takes input and splits it into a sequence of tokens. A token is a group of characters which form some unit.

Computing Concepts with Java Essentials

Swing. A Quick Tutorial on Programming Swing Applications

Introduction to Object-Oriented Programming

Dinopolis Java Coding Convention

Pearson Onscreen Platform (POP) Using POP Offline testing system guide

Essentials of the Java(TM) Programming Language, Part 1

Part 1 Foundations of object orientation

How To Write A Program For The Web In Java (Java)

Mathematical Card Tricks

Event processing in Java: what happens when you click?

JAVA Program For Processing SMS Messages

Training Manual. Shuffle Master Gaming Three Card Poker Training Manual R

Terms and Conditions for Charitable Texas Hold em Poker Tournaments

Event-Driven Programming

IRA EXAMPLES. This topic has two examples showing the calculation of the future value an IRA (Individual Retirement Account).

Transcription:

CSCI 143 Exam 2 Name 1 Hour, Closed Notes, Browser open to Java API docs is OK A. Short Answer For questions 1 5 credit will only be given for a correct answer. Put each answer on the appropriate line. 1. [4] In the Java AWT, a WindowListener registered with a Frame can be used so that a click in the go away box of the frame s window will close the program. (T/F) 1. 2. [4] If an exception is thrown while a program is running then you can be certain that the programmer has made an error. (T/F) 2. 3. [4] In the Java AWT, a MouseListener object registered with a Button causes a click on that Button to activate the code in the mouseclicked method of the MouseListener object. (T/F) 3. 4. [4] When using GridLayout, one needs to specify the geographic location (i.e. North, South, etc.) of each Component added to the Container. (T/F) 4. 5. [4] It is ok for a class to define two methods with the same name, as in the code below: (T/F) 5. public void setmood() { System.out.println("I am a happy person"); public void setmood(string mood) { System.out.println("I am a "+mood+" person"); 1

B. Medium Answer Answer each of the following as directed, or using one or two sentences. Some partial credit may be given. 6. [8] A java.awt.button object has a processevent method as well as a processactionevent method. What is the difference between the two? 7. [8] Predict the output when the following Java program runs. public class Mystery { int y = 4; public int divide12(int x) throws Exception { if (x == 0) throw(new Exception()); else return(12/x); public void test() { try { System.out.println("12 divided by " + y + " is " + divide12(y)); catch(exception e) { System.out.println("The end"); return; y = y - 1; test(); public static void main(string[] args) { Mystery m = new Mystery(); m.test(); 2

C. Long Answer Solve each of the following in the space provided (use the back of the facing page if necessary). Partial credit may be given. 8. [8] I am working on a class that extends java.awt.frame. I want my Frame to have 10 circles each having a color chosen at random and each having a random diameter between 5 and 20 units. The circles are placed at random locations within the frame. Write the paint method. As a hint, the expression (int) ((30 * Math.random()) + 10 returns a random int between 10 and 40. Another hint is that you can generate a random color by a call to new Color(***, ***, ***) where each of the *** should be replaced by its own random int in the range 0-255. 9. [8] Now I want exactly the same functionality but I want to extend javax.swing.jframe instead of java.awt.frame. Explain what needs to change. 3

10. [8] We never did do any audio during this course. Until now!! If you decided you needed to add music to one of your AWT or Swing programs, how would you do it? Describe some steps you would take. What do you look for? Where do you look? How do you look? What kind of documentation do you hope to find? What kind of tutorial material do you expect to find? Describe your research process and a few, a very few, key discoveries. 4

11. [20] I want to design a Java program to play Poker. You do not need to know anything about Poker beyond what is given in this question. Poker is a game played with a standard deck of 52 cards played by a number of players sitting around a table. Also seated at the table is a dealer. Each player possesses a stack of chips (tokens of monetary value with which to bet). A game proceeds as follows: (a) Each player places one chip onto the table. This initial, compulsory bet is called the Ante. (b) The dealer deals two cards to each of the players. (These cards are dealt face down, and only the player is able to see those cards.) We call these the hidden cards. Each player has two, and nobody knows what hidden cards the other players hold. (c) A round of betting takes place. Each player in turn may choose to fold, call, or raise. (Do not worry about the meaning of those terms. Just be aware that they may involve placing some of the player s chips on the table.) (d) Now the dealer deals three cards face up on the table. These are the first three of what will eventually be five community cards. Each player will, eventually, generate their best 5-card poker hand by choosing five out of seven available cards. (Do not worry about what constitutes the best poker hand: Just think of it a 5- card subset chosen according to some strategy from the seven available.) For each player the seven available cards are their own two hidden cards and the eventual five community cards. (e) Before the fourth community card is dealt, there will be a round of betting, during which each player may fold, call or raise. (f) Then the dealer deals the fourth community card face up on the table where every player can see it. (g) Then another round of betting. (h) Then the fifth and final community card is dealt. (i) Then the final round of betting. (j) At the end of the final round of betting, any players who have not previously folded will show their hands and the best hand takes all of the chips that have been bet. You are not to write Java code for this question. Just design some classes, and think about where various variables and methods belong. This question is continued on the next page, where a table is provided in which you can enter your answers. 5

In the first column is a list of potential classes, each with a name that should suffice for you to understand its purpose. Space is provided for you to add more classes. Do so, and choose meaningful names. In the second column is the parent class. It may be that your classes extend known Java classes. This is where you write the name of the parent class. If you don t need inheritance, just extend java.lang.object. You should also use the second column to list any interfaces you want your class to implement. The third column lists some of the variables used to store the object s state. Choose meaningful names. The last column should list some of the public methods. Name them. There is no single correct answer to this question. Try to think through the early stages of solving the poker simulation problem and design a workable scenario. If you need more classes than I ve provided space for then make space. Class extends Variables public Methods Card java.awt.component boolean faceup; public void paint() Dealer Table Player 6

12. [4] In one or two sentences explain what is a Thread. 13. [4] I have a class called Frog that is to be used in a video game that I m designing. Write two headers that I can use for the class in order that any Frog object will be able to run as an independent thread. (a) public class Frog { (b) public class Frog { 14. [4] Whichever way I declare the class Frog, there is one method that I absolutely must define (in one case) and definitely should override (in the other case). What is that method? 15. [4] In my video game I also have a class LilyPad. It has a method public boolean isoccupied() that a Frog object can call to find out if there is already a frog on the LilyPad object, and a public void climbon(frog client) that a Frog object can call in order to place itself on this LilyPad object. As you know, it is not desirable for more than one frog to sit on the same lily pad, so within the Frog class we have code: LilyPad lily = new LilyPad();... if (lily.isoccupied()) { // do nothing else { lily.climbon(this); Clearly the intention is that no Frog object should ever attempt to climb on to a LilyPad object that another Frog object is already sitting on. Sadly, when I run my game, I find that occasionally a Frog will attempt to climb on to an already occupied LilyPad. Explain. 16. [4] Fix the problem. Write code for the LilyPad class to be called from the Frog class and explain why it will make it impossible for a frog to climb an occupied lilypad. 7