Casino Games

You might also like

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 12

Roland Bernard, CST-338

Video presentation

Assignment 2: Casino
Approaching the project

• Make sure you understand what is going on


• Take notes and highlight key information while reading
• Import all the necessary classes
• Start writing code
• Testing and debugging
• Submit assignment
Understand the Project

Assuming you declare your Variables


like this:
• String1= Cherries;
• String2= Bar;
• String3 = Space;
• String4 = “7”;
Highlight Key Info
• How frequent something will • When to declare winning:
• Cherries,  [not cherries],  [any] 
appear:
pays 5 × bet (5 times the bet)
• space        1/2   (50%) • Cherries,  cherries  [not cherries] 
• Cherries  1/4  (25%) pays 15 × bet
• cherries  cherries  cherries 
• BAR          1/8  (12.5%)
pays 30 × bet
• 7              1/8  (12.5%) • BAR  BAR  BAR
pays 50 × bet
• 7  7  7 pays 100 × bet
Key info Continued
Warning: Order matters: • Multipliers:
• cherries bar cherries pays 5× • you can create a multiplier by
default to be zero
• while cherries cherries bar pays • change it when the right
15× combination comes up like
• and bar cherries cherries pays • x5, x15, x30, x50, x100
nothing.
Project Spec
• The program Spec is extremely important to • A Private Helper Method
follow: located on the assignment section.
• The data section
• boolean validString( String str )
• Your Strings (name them accordingly) • This method returns true if both the
• Set up your final int MAX_LEN set to 20 string  is not null and its length <=
• Summary MAX_LEN and false, otherwise.
• Three private instances strings,
• One private static int array,
• One private static int variable,
• and two public static final ints
Program Spec: Import Classes
• Make sure you call your class
Class ThreeString as
recommended.
• Name your strings, your ints, all
you methods as suggested in the
assignment
Classes:  (Static main class methods)
• int getBet() • String randString()
• To prompt users to bet an amount • Using Math.Random();
between 0 and 100 dollars.
• Suggestion using a number between
Public static getBet () { 1 and 1000;
Write your printout statement here and • Pay close attention to if statement
your validation process to make sure the here
users enter only numbers between 0 and
100 with 0 to quit. • The percentage each variable will
appear
}
CoinFlip Slide(Page 193 text 6th ed)
Static main class methods continued…

• int getPayMultiplier (ThreeString • Review key info that you noted


thePull) about the multipliers.
• Public static ThreeStringthePull(){ • x5, x15, x30 and x50, x100
• You declare your new string here
and set all ways you would like the
program to randomize the result • Optional x0
• }
Static main methods continued…
• void display (ThreeStringthePull, • main()'s Workflow
int winnings ) • Here you manage how the a player
• This is where you set up your output can stay in the game.
message to tell the users that they • Non Zero number
won (and how much), or they lose.
Conclusion
• Test your code multiple time for the best output.
• Review the assignment instructions to make sure you cover everything
• When you satisfy:
• Copy your source code and your output into a text editor
• Add your name, the class, and your comments
• Good luck!

You might also like