|
10-sided Dice Lotto?
|
|
04-15-2009, 09:09 AM
Post: #1
|
|||
|
|||
|
10-sided Dice Lotto?
I have my Dice object created below:
/** * @author Cal7169 Christopher Lewis * @version Apr 15, 2009 * create a die object */ import java.util.Random; public class Die { private Random generator; private int numSides; public Die(int y) { numSides = y; generator = new Random(); } public int cast() { return 1 + generator.nextInt(numSides); } } But i am stuck in creating my lottery game: This is what i have so far: import java.util.Scanner; public class lewisLotto { /** * @param args */ public static void main(String[] args) { Die myDie = new Die(9); int rolls = 20; for(int j=1; j<=rolls; j++) { int num = myDie.cast(); System.out.println(num + ""); System.out.print("Time to play the lotto!"); System.out.print("Enter 3 for Daily Number, 4 for Big Four, and 5 For Quinto "); And this is what i would like to do: 3 Daily Number 4 Big Four 5 Quinto Enter the game number (number of digits needed): 2 Please enter a number between 3 and 5 3 Daily Number 4 Big Four 5 Quinto Enter the game number (number of digits needed): 3 Enter the year you were born: 2000 Enter the month you were born (1-12): 10 Enter the day of the month you were born (1-31): 1 I rolled the dice 2011 times. Your lucky number is... 723 ----- 3 Daily Number 4 Big Four 5 Quinto Enter the game number (number of digits needed): 4 Enter the year you were born: 1000 Enter the month you were born (1-12): 10 Enter the day of the month you were born (1-31): 9 I rolled the dice 1019 times. Your lucky number is... 3059 ----- 3 Daily Number 4 Big Four 5 Quinto Enter the game number (number of digits needed): 5 Enter the year you were born: 5 Enter the month you were born (1-12): 5 Enter the day of the month you were born (1-31): 5 I rolled the dice 15 times. Your lucky number is... 09286 Someone plz help, i'm a beginner programer and would like to know the most basic way to do this Thankyou[/u][/b] |
|||
|
04-15-2009, 06:46 PM
Post: #2
|
|||
|
|||
|
RE: 10-sided Dice Lotto?
This would a simple program. I am not sure where exactly you are stuck. If you can tell me the logic of finding the lucky number, I will be able to help.
|
|||
|
« Next Oldest | Next Newest »
|

Search
Member List
Calendar
Help



