Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.jdwsoftware.wfh.model
Class MathGame  view MathGame download MathGame.java

java.lang.Object
  extended bycom.jdwsoftware.wfh.model.GameType
      extended bycom.jdwsoftware.wfh.model.MathGame

public class MathGame
extends GameType

Title: Woody's Fishing Hole

Description: Educational Fishing Game

Copyright: Copyright (C) 2003 JDW Software, LLC

Company: JDW Software, LLC

This game diplays an simple math problem, a number 1-9 a plus sign and another number 1-9. The answers are the sum of the two numbers

Version:
$Revision: 1.8 $

Field Summary
private  java.awt.Image _answerImage
           
private  java.awt.Font _bigFont
           
private  java.util.Hashtable _images
           
private  java.lang.String _question
           
private static java.lang.String[] ANSWERS
           
private static java.lang.String COPYRIGHT
           
private static java.util.Random r
           
private static java.lang.String VERSION
           
 
Fields inherited from class com.jdwsoftware.wfh.model.GameType
_caller, BORDER, HEIGHT, WIDTH
 
Constructor Summary
MathGame(javax.swing.JComponent caller)
           
 
Method Summary
 java.lang.String getAnswer()
          Get the string representation of the answer to getQuestion()
 java.awt.Image getAnswer(java.lang.String s)
          Given an answer string, get the corresponding image to put on the fish.
 java.awt.Image getQuestion()
          Get the question image this is to be displayed on the passed component
 java.lang.String[] getValidAnswers()
          Get a set of all possible answers.
 void newQuestion()
          Call new question to generate a new question and answer
 
Methods inherited from class com.jdwsoftware.wfh.model.GameType
getHeight, getWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COPYRIGHT

private static final java.lang.String COPYRIGHT
See Also:
Constant Field Values

VERSION

private static final java.lang.String VERSION
See Also:
Constant Field Values

ANSWERS

private static final java.lang.String[] ANSWERS

_images

private java.util.Hashtable _images

_answerImage

private java.awt.Image _answerImage

_bigFont

private java.awt.Font _bigFont

_question

private java.lang.String _question

r

private static java.util.Random r
Constructor Detail

MathGame

public MathGame(javax.swing.JComponent caller)
Method Detail

newQuestion

public void newQuestion()
Description copied from class: GameType
Call new question to generate a new question and answer

Specified by:
newQuestion in class GameType

getQuestion

public java.awt.Image getQuestion()
Description copied from class: GameType
Get the question image this is to be displayed on the passed component

Specified by:
getQuestion in class GameType

getAnswer

public java.lang.String getAnswer()
Description copied from class: GameType
Get the string representation of the answer to getQuestion()

Specified by:
getAnswer in class GameType

getValidAnswers

public java.lang.String[] getValidAnswers()
Description copied from class: GameType
Get a set of all possible answers. This is a set of string answers.

Specified by:
getValidAnswers in class GameType

getAnswer

public java.awt.Image getAnswer(java.lang.String s)
Description copied from class: GameType
Given an answer string, get the corresponding image to put on the fish.

Specified by:
getAnswer in class GameType