import javax.swing.JOptionPane;
publicclassGuessBirthday{publicstaticvoidmain(String[]args){Stringset1="1357\n"+"9111...
public class GuessBirthday{
public static void main(String[] args){
String set1 = "1 3 5 7\n" + "9 11 13 15\n" + "17 19 21 23\n" + "25 27 29 31";
String set2 = "2 3 6 7\n" + "10 11 14 15\n" + "18 19 22 23\n" + "26 27 30 31";
String set3 = "4 5 6 7\n" + "12 13 14 15\n" + "20 21 22 23\n" + "28 29 30 31";
String set4 = "8 9 10 11\n" + "12 13 14 15\n" + "24 25 26 27\n" + "28 29 30 31";
String set5 = "16 17 18 19\n" + "20 21 22 23\n" + "24 25 26 27\n" + "28 29 30 31";
int day = 0;
String yourBirthday = "Is your birthday in Set1\n" ;
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 1;
String yourBirthday = "Is your birthday in Set2\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour= Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 2;
String yourBirthday = "Is your birthday in Set3\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 4;
String yourBirthday = "Is your birthday in Set4\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 8;
String yourBirthday = "Is your birthday in Set5\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 16;
String birthday = "你的生日是:" + day + "号!";
JOptionPane.showMessageDialog(null,birthday);
}
}
哪位大神帮忙看以这个错在哪了,编译的时候提示:已在方法main(String[])定义了birthday、yourbirthday、numberOfYour.numberYour、,急急急!!! 展开
public static void main(String[] args){
String set1 = "1 3 5 7\n" + "9 11 13 15\n" + "17 19 21 23\n" + "25 27 29 31";
String set2 = "2 3 6 7\n" + "10 11 14 15\n" + "18 19 22 23\n" + "26 27 30 31";
String set3 = "4 5 6 7\n" + "12 13 14 15\n" + "20 21 22 23\n" + "28 29 30 31";
String set4 = "8 9 10 11\n" + "12 13 14 15\n" + "24 25 26 27\n" + "28 29 30 31";
String set5 = "16 17 18 19\n" + "20 21 22 23\n" + "24 25 26 27\n" + "28 29 30 31";
int day = 0;
String yourBirthday = "Is your birthday in Set1\n" ;
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 1;
String yourBirthday = "Is your birthday in Set2\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour= Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 2;
String yourBirthday = "Is your birthday in Set3\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 4;
String yourBirthday = "Is your birthday in Set4\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 8;
String yourBirthday = "Is your birthday in Set5\n";
String birthday = yourBirthday + set1 + "请输入:0代表否,1代表是。";
String numberOfYour = JOptionPane.showInputDialog(birthday);
int numberYour = Integer.parseInt(numberOfYour);
if (numberYour == 1) day += 16;
String birthday = "你的生日是:" + day + "号!";
JOptionPane.showMessageDialog(null,birthday);
}
}
哪位大神帮忙看以这个错在哪了,编译的时候提示:已在方法main(String[])定义了birthday、yourbirthday、numberOfYour.numberYour、,急急急!!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询