27a_Assignment_6

27a_Assignment_6 - Assignment 6 - Gambling with Methods...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Assignment 6 - Gambling with Methods Select one option from the four below. All options are worth the same number of points. The more advanced options are provided for students who find the basic ones too easy and want more of a challenge. Make sure you have read and understand the Modules Information About Programming Assignments and Style Rules for Assignments before submitting this assignment. Hand in only one program, please. For this assignment you will have to investigate the use of the Java random number generator function, Math.random() . You can find this in the text or using the online resources given in the lectures. OPTION A (Basic): A Simple Slot Machine The program will loop, asking the user for a bet amount from 0 to 100 (assume dollars, you can use ints or longs ). If the user types a 0 that means he/she wants to quit. Otherwise, accept the amount as their bet and simulates a slot machine pull . Your program will print out a line that looks like a slot machine result containing three Strings. Some examples are: BAR 7 BAR , 7 7 cherries , cherries BAR space , space BAR BAR , or cherries cherries BAR . Each of the three positions in the String could be one of the following: " BAR ", " 7 ", " cherries " or " space ". Each of the three output positions is determined randomly with equal probability: there is 1/4 or 25%
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/21/2011 for the course CIS 27A taught by Professor Unknown during the Spring '07 term at Foothill College.

Page1 / 2

27a_Assignment_6 - Assignment 6 - Gambling with Methods...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online