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: