title: Lottery Game using Math.random() in java
body: <p>We are assigned to develop a program  to play lottery.The program will randomly generates lottery of a two-digit numbers, and prompts the user to input a two-digit numbers. And if the numbers is only a single digit(0-9) the numbers must be treated as a two-digit number (00 - 09). Below are the conditions:</p>
  
  <ol>
  <li>If the user input matches the lottery numbers in exact order, the reward is Php 100,000.</li>
  <li>If all numbers in the user input matches all the lottery numbers, the reward is Php 30,000.</li>
  <li>If only one number in the user input matches a lottery number, the reward is Php 10,000.</li>
  </ol>
  
  <p>This is my code so far...I actually have a problem on the 2nd condition (reward is Php30,000) whenever I matched only 1 number it says that "You matched all the lottery numbers. You won Php30,000."</p>
  
  <pre><code>public static void main(String[] args) {
      Scanner lottery = new Scanner(System.in);
      int lottery1, lottery2, lottery3;
      System.out.println("\t\t\t\t\t\t~Welcome to THE LOTTERY~");
      System.out.println("Enter your first two-digit lucky number!");
      int guess1 = lottery.nextInt();
      System.out.println("Enter your second two-digit lucky number!");
      int guess2 = lottery.nextInt();
      System.out.println("Enter your last two-digit lucky number!");
      int guess3 = lottery.nextInt();
      System.out.println("\nThe winning numbers are: ");
      System.out.printf("%02d", lottery1 = (int)(Math.random() * 10));
      System.out.printf("\n" + "%02d", lottery2 = (int)(Math.random() * 10));
      System.out.printf("\n" + "%02d", lottery3 = (int)(Math.random() * 10));
      if(guess1 == lottery1 &amp;&amp; guess2 == lottery2 &amp;&amp; guess3 == lottery3 ){
          System.out.println("\n\nCongratulations! You matched all the lottery numbers in order.");
          System.out.println("You won Php100,000!");
      }else if(guess1 == lottery1 || lottery1 == guess1 &amp;&amp; guess1 == lottery2 || lottery2 == guess1 &amp;&amp; guess1 == lottery3 || lottery3 == guess1
              &amp;&amp; guess2 == lottery1 || lottery1 == guess2 &amp;&amp; guess2 == lottery2 || lottery2 == guess2 &amp;&amp; guess2 == lottery3 || lottery3 == guess1
              &amp;&amp; guess3 == lottery1 || lottery1 == guess3 &amp;&amp; guess3 == lottery2 || lottery2 == guess3 &amp;&amp; guess3 == lottery3 || lottery3 == guess3){
          System.out.println("\n\nCongratulations! You matched all the lottery numbers.");
          System.out.println("You won Php30,000!");
      }else if(guess1 == lottery1 || guess1 == lottery2 || guess1 == lottery3
              || guess2 == lottery1 || guess2 == lottery2 || guess2 == lottery3
              || guess3 == lottery1 || guess3 == lottery2 || guess3 == lottery3){
          System.out.println("\n\nCongratulations! You matched a lottery number.");
          System.out.println("You won Php10,000!");
      }else{
          System.out.println("\n\nSorry, your lucky numbers didn't matched any of the lottery numbers!");
      }
  }`
  </code></pre>