lottery games 10-17-2013, 08:15 AM
#1
hello guys, i have bored and have make one game, the game i make i lottery games. so i want shared resources... take it..
-changed quote tags to code tags- staff
Code:
import javax.swing.*;
import java.text.*;
public class lotterygames
{
public static void main(String [] args)
{
lotterygames startx=new lotterygames();
startx.start();
}
public void start()
{
try
{
String ch=JOptionPane.showInputDialog("1.lottery games \n 2.about \n 3.Exit");
int x=Integer.parseInt(ch);
String aboutt="qoley.tseven";
String err="please enter only number one and two";
switch(x)
{
case 1:
lotterygames lg=new lotterygames();
lg.lottery();
break;
case 2:
JOptionPane.showMessageDialog(null,aboutt, "by QOLEY TSEVEN",JOptionPane.INFORMATION_MESSAGE);
lotterygames startx2=new lotterygames();
startx2.start();
case 3:
String bye="are you sure want to exit and go to toilet?";
int ss=JOptionPane.showConfirmDialog(null,bye,"qoley tseven",JOptionPane.YES_NO_OPTION);
if(ss==JOptionPane.YES_OPTION)
{
JOptionPane.showMessageDialog(null,"booooo, i know u want go to toilet... it's ok...\n bye bye","qoley tseven",JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
else if(ss==JOptionPane.NO_OPTION)
{
JOptionPane.showMessageDialog(null, "i think you're lucky","qoley tseven",JOptionPane.INFORMATION_MESSAGE);
lotterygames startx50=new lotterygames();
startx50.start();
}
break;
default:
JOptionPane.showMessageDialog(null, err, "error",JOptionPane.ERROR_MESSAGE);
lotterygames startx3=new lotterygames();
startx3.start();
}
}
catch(Exception e)
{
String err1="please enter only number one and two";
JOptionPane.showMessageDialog(null, err1, "error",JOptionPane.ERROR_MESSAGE);
lotterygames startx1=new lotterygames();
startx1.start();
}
}
public void lottery()
{
try
{
String num=JOptionPane.showInputDialog("please enter your four digit lottery number");
int z=Integer.parseInt(num);
String about1="are you want continue?";
int lt=(int) (Math.random() *9999) +1;
if((z>=10000))
{
JOptionPane.showMessageDialog(null,"please enter only 4 digit number");
lotterygames startx35=new lotterygames();
startx35.lottery();
}
else if(z==lt)
{
JOptionPane.showMessageDialog(null,"wow. you're a winner.. thanks...");
int n=JOptionPane.showConfirmDialog(null,about1,"ARE YOU WANT CONTINUE?",JOptionPane.YES_NO_OPTION);
if(n==JOptionPane.YES_OPTION)
{
lotterygames startx32=new lotterygames();
startx32.lottery();
}
else if(n==JOptionPane.NO_OPTION)
{
System.exit(0);
}
}
else
{
String aboutt="";
aboutt=aboutt+"boooo.... you're loser.. please try again ... \n the winnner number is :"+lt;
JOptionPane.showMessageDialog(null,aboutt,"qoley tseven",JOptionPane.INFORMATION_MESSAGE);
lotterygames startx3=new lotterygames();
startx3.start();
}
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null, "please enter only four digit number. symbol and character not allowed \n press OK for continue");
lotterygames startx31=new lotterygames();
startx31.start();
}
}
}-changed quote tags to code tags- staff
don't try learn to hack, hack to learn
![[Image: 2nqunnkjpg_zps9b76c611.gif]](http://i1354.photobucket.com/albums/q692/Qoley_Tseven/2nqunnkjpg_zps9b76c611.gif)




![[+]](https://sinister.li/images/modern/collapse_collapsed.png)
You will need to compile it using command prompt to create the class file, and then run it