Javagui guess the Birthday game

Source: Internet
Author: User

Xuwen Friend 5 questions to find out which day he was born in one months, each question is asked whether his birthday is in the collection of numbers.
Birthdays are the sum of the first digits of each collection that appears on this day.

Import Javax.swing.JOptionPane;  public class Guessbirthday {public static void main (string[] args) {String s1= "1 3 5 7\n" + "9 11
      15\n "+" 23\n "+" 25 27 29 31 ";
      String s2= "2 3 6 7\n" + "15\n" + "23\n" + "26 27 30 31";
      String s3= "4 5 6 7\n" + "15\n" + "23\n" + "28 29 30 31";
      String s4= "8 9 11\n" + "15\n" + "27\n" + "28 29 30 31";
      String s5= "19\n" + "23\n" + "27\n" + "28 29 30 31";
      int day=0; int Ans=joptionpane.showconfirmdialog (NULL, "is your birthday in these numbers?")
      \ n "+s1);

      if (ans==joptionpane.yes_option) day+=1; Ans=joptionpane.showconfirmdialog (NULL, "is your birthday in these numbers?")
      \ n "+s2);

      if (ans==joptionpane.yes_option) day+=2; Ans=joptionpane.showconfirmdialog (NULL, "is your birthday in these numbers?") \ n "+S3);

       if (ans==joptionpane.yes_option) day+=4; Ans=joptionpane.showconfirmdialog (NULL, "is your birthday in these numbers?")
      \ n "+s4);

       if (ans==joptionpane.yes_option) day+=8; Ans=joptionpane.showconfirmdialog (NULL, "is your birthday in these numbers?")
      \ n "+s5);
      if (ans==joptionpane.yes_option) day+=16; Joptionpane.showmessagedialog (NULL, "You are +day+" day.)

  "); }
}

Display effect:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.