Java 为什么赢了';我的字符串没有激活吗?
我的问题是,我试图使一条消息声明为字符串显示,这取决于它是真是假。未返回正确值的字符串为:snakeyarmsg 我一整天都在试图让这个字符串返回所需的值,但没有结果。最后,我尝试了一种蛮力方法,列出了SNAKE_年所有可能的可用性 该程序允许用户输入数据,然后根据输入计算“Essscore”。我的问题是,最后一次向用户输出的数据始终显示用户出生在“蛇年”(中国十二生肖中的蛇年),即使不是 这个项目是为一个我已经忘记的任务而设计的,它离到期日越来越近了,所以任何帮助都将不胜感激 代码如下:Java 为什么赢了';我的字符串没有激活吗?,java,string,jcreator,Java,String,Jcreator,我的问题是,我试图使一条消息声明为字符串显示,这取决于它是真是假。未返回正确值的字符串为:snakeyarmsg 我一整天都在试图让这个字符串返回所需的值,但没有结果。最后,我尝试了一种蛮力方法,列出了SNAKE_年所有可能的可用性 该程序允许用户输入数据,然后根据输入计算“Essscore”。我的问题是,最后一次向用户输出的数据始终显示用户出生在“蛇年”(中国十二生肖中的蛇年),即使不是 这个项目是为一个我已经忘记的任务而设计的,它离到期日越来越近了,所以任何帮助都将不胜感激 代码如下: /*
/*Program designed by Some guy
*for KXT101 Assignment Number One*/
import java.util.Scanner;
public class AssigOne113
{
public static void main (String[] args)
{
final int CURRENT_YEAR = 2013;
final int CALENDER_ROTATION = 12;
final int SNAKE_YEAR = CURRENT_YEAR | 2001 | 1989 | 1977 | 1965 | 1953 | 1941 | 1929 | 1917 | 1905 | 1893 | 1881 | 1869 |
1857 | 1845 | 1833 | 1821 | 1809 | 1797 | 1785 | 1773 | 1761 | 1749 | 1737 | 1725 | 1713 | 1701 |
1689 | 1677 | 1665 | 1653 | 1641 | 1629 | 1617 | 1605 | 1593 | 1581 | 1569 | 1557 | 1545 | 1533 |
1521 | 1509 | 1497 | 1485 | 1473 | 1461 | 1449 | 1437 | 1425 | 1413 | 1401 | 1389 | 1377 | 1365 |
1353 | 1341 | 1329 | 1317 | 1305 | 1293 | 1281 | 1269 | 1257 | 1245 | 1233 | 1221 | 1209 | 1197 |
1185 | 1173 | 1161 | 1149 | 1137 | 1125 | 1113 | 1101 | 1089 | 1077 | 1065 | 1053 | 1041 | 1029 |
1017 | 1005 | 993 | 981 | 969 | 957 | 945 | 933 | 921 | 909 | 897 | 885 | 873 | 861 |
849 | 837 | 825 | 813 | 801 | 789 | 777 | 765 | 753 | 741 | 729 | 717 | 705 | 693 |
681 | 669 | 657 | 645 | 633 | 621 | 609 | 597 | 585 | 573 | 561 | 549 | 537 | 525 |
513 | 501 | 489 | 477 | 465 | 453 | 441 | 429 | 417 | 405 | 393 | 381 | 369 | 357 |
345 | 333 | 321 | 309 | 297 | 285 | 273 | 261 | 249 | 237 | 225 | 213 | 201 | 189 |
177 | 165 | 153 | 141 | 129 | 117 | 105 | 93 | 81 | 69 | 57 | 45 | 33 | 21 |
9;
final int SUMMER_MONTH_JAN = 1;
final int SUMMER_MONTH_FEB = 2;
final int SUMMER_MONTH_DEC = 12;
final int AUTUMN_MONTH_MAR = 3;
final int AUTUMN_MONTH_APR = 4;
final int AUTUMN_MONTH_MAY = 5;
final int WINTER_MONTH_JUN = 6;
final int WINTER_MONTH_JUL = 7;
final int WINTER_MONTH_AUG = 8;
final int SPRING_MONTH_SEP = 9;
final int SPRING_MONTH_OCT = 10;
final int SPRING_MONTH_NOV = 11;
final int SIXTH_DAY = 06;
final int SEVENTH_DAY = 07;
final int JANUARY = 1;
final int FEBUARY = 2;
final int MARCH = 3;
final int APRIL = 4;
final int MAY = 5;
final int JUNE = 6;
final int JULY = 7;
final int AUGUST = 8;
final int SEPTEMBER = 9;
final int OCTOBER = 10;
final int NOVEMBER = 11;
final int DECEMBER = 12;
final int CALENDER_MAX = 12;
Scanner sc;
String essscorecalculate;
String essscorerepeat;
String userName;
int birthYear;
String junk;
int yob;
int day;
int month = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
int essscore = 0;
String summer = "Summer";
String autumn = "Autumn";
String winter = "Winter";
String spring = "Spring";
String seasonBorn = "any season";
String monthBorn = "any month";
String snakeYearMsg = "the year";
boolean snakeYearBool;
boolean haveS;
double birthDay;
char initial;
//program begins
System.out.println(" ");
System.out.println("<------------------------------------------->");
System.out.println("Sammy Snakes Sixth/Seventh Spring Of Success");
System.out.println("<------------------------------------------->");
System.out.println(" ");
System.out.println("<------------------------------------------->");
System.out.println(" I can calculate an Ess-Score for you ");
System.out.println(" Would you like to calculate an Ess-Score? ");
System.out.println("<------------------------------------------->");
sc = new Scanner(System.in);
essscorecalculate = sc.nextLine();
{
/*essscore.Reset;*/
{
}
}
System.out.println("<------------------------------------------->");
System.out.println(" To begin, what is your name? ");
System.out.println("<------------------------------------------->");
userName = sc.nextLine();
initial =(userName.charAt(0));
{
if (initial == 'S')
essscore =+ 4;
if (initial == 's')
essscore =+ 4;
}
System.out.println("<----------------------------------------------------------------->");
System.out.println(" What year were you born? (Please enter in following format XXXX) ");
System.out.println("<----------------------------------------------------------------->");
birthYear = sc.nextInt();
junk = sc.nextLine();
{
{
if (birthYear == SNAKE_YEAR)
snakeYearBool = true;
/* essscore =+ 16; */
else if (birthYear != SNAKE_YEAR)
snakeYearBool = false;
}
{
if (snakeYearBool = false)
snakeYearMsg = "A non Snake year";
if (snakeYearBool = true)
snakeYearMsg = "Snake year";
if (birthYear != SNAKE_YEAR)
essscore ++;
}
}
System.out.println("<--------------------------------------------------------------------->");
System.out.println("Please enter your birthday (please enter in the following format DD.MM)");
System.out.println("<--------------------------------------------------------------------->");
birthDay = sc.nextDouble();
junk = sc.nextLine();
{
{
day = (int)birthDay;
if (day == SIXTH_DAY)
essscore =+ 8;
if (day == SEVENTH_DAY)
essscore =+ 8;
}
{
month = ((int)Math.round(100*birthDay))%100;
/*System.out.print(month);*/
}
{
if (month == 1)
monthBorn = "January";
if (month == 2)
monthBorn = "Febuary";
if (month == 3)
monthBorn = "March";
if (month == 4)
monthBorn = "April";
if (month == 5)
monthBorn = "May";
if (month == 6)
monthBorn = "June";
if (month == 7)
monthBorn = "July";
if (month == 8)
monthBorn = "August";
if (month == 9)
monthBorn = "September";
if (month == 10)
monthBorn = "October";
if (month == 11)
monthBorn = "November";
if (month == 12)
monthBorn = "December";
}
{
if (month == SPRING_MONTH_SEP)
essscore =+2;
if (month == SPRING_MONTH_OCT)
essscore =+2;
if (month == SPRING_MONTH_NOV)
essscore =+2;
{
if (month == SPRING_MONTH_SEP)
seasonBorn = "Spring";
else if (month == SPRING_MONTH_OCT)
seasonBorn = "Spring";
else if (month == SPRING_MONTH_NOV)
seasonBorn = "Spring";
else if (month ==AUTUMN_MONTH_MAR)
seasonBorn = "Autumn";
else if (month ==AUTUMN_MONTH_APR)
seasonBorn = "Autumn";
else if (month ==AUTUMN_MONTH_MAY)
seasonBorn = "Autumn";
else if (month == WINTER_MONTH_JUN)
seasonBorn = "Winter";
else if (month == WINTER_MONTH_JUL)
seasonBorn = "Winter";
else if (month == WINTER_MONTH_AUG)
seasonBorn = "Winter";
else if (month == SUMMER_MONTH_JAN)
seasonBorn = "Summer";
else if (month == SUMMER_MONTH_FEB)
seasonBorn = "Summer";
else if (month == SUMMER_MONTH_DEC)
seasonBorn = "Summer";
}
}
}
System.out.println("<------------------------------------------------>");
System.out.println(""+userName+" was born in "+seasonBorn+" on "+monthBorn+" "+day+" in "+snakeYearMsg+" "+birthYear+" ");
System.out.println(""+essscore+"");
System.out.println("<------------------------------------------------>");
System.out.println("<------------------------------------------------>");
System.out.println(" Would you like to calculate another Ess-Score? ");
System.out.println("<------------------------------------------------>");
essscorerepeat = sc.next();
}
/*某个人设计的程序
*对于KXT101任务编号1*/
导入java.util.Scanner;
公共课助理113
{
公共静态void main(字符串[]args)
{
当前年度的最终int=2013年;
最终int压延机旋转=12;
最后一年=本年| 2001 | 1989 | 1977 | 1965 | 1953 | 1941 | 1929 | 1917 | 1905 | 1893 | 1881 | 1869|
1857 | 1845 | 1833 | 1821 | 1809 | 1797 | 1785 | 1773 | 1761 | 1749 | 1737 | 1725 | 1713 | 1701 |
1689 | 1677 | 1665 | 1653 | 1641 | 1629 | 1617 | 1605 | 1593 | 1581 | 1569 | 1557 | 1545 | 1533 |
1521 | 1509 | 1497 | 1485 | 1473 | 1461 | 1449 | 1437 | 1425 | 1413 | 1401 | 1389 | 1377 | 1365 |
1353 | 1341 | 1329 | 1317 | 1305 | 1293 | 1281 | 1269 | 1257 | 1245 | 1233 | 1221 | 1209 | 1197 |
1185 | 1173 | 1161 | 1149 | 1137 | 1125 | 1113 | 1101 | 1089 | 1077 | 1065 | 1053 | 1041 | 1029 |
1017 | 1005 | 993 | 981 | 969 | 957 | 945 | 933 | 921 | 909 | 897 | 885 | 873 | 861 |
849 | 837 | 825 | 813 | 801 | 789 | 777 | 765 | 753 | 741 | 729 | 717 | 705 | 693 |
681 | 669 | 657 | 645 | 633 | 621 | 609 | 597 | 585 | 573 | 561 | 549 | 537 | 525 |
513 | 501 | 489 | 477 | 465 | 453 | 441 | 429 | 417 | 405 | 393 | 381 | 369 | 357 |
345 | 333 | 321 | 309 | 297 | 285 | 273 | 261 | 249 | 237 | 225 | 213 | 201 | 189 |
177 | 165 | 153 | 141 | 129 | 117 | 105 | 93 | 81 | 69 | 57 | 45 | 33 | 21 |
9;
最终国际夏季月1日=1;
最终国际夏季月二月=2;
最终国际夏季月12日=12;
最后一个秋季月3月=3;
最后一年秋季月4月=4;
最后一个秋季、月份、五月=5;
最终冬季月6日;
最终国际冬季月7月=7;
最终国际冬季月8月=8;
春季、月份和九月的最终积分=9;
最终int春季、月份、十月=10;
最终整数春季\月份\十一月=11;
最终int第六天=06;
最终int第七天=07;
最终int一月=1;
最终整数2月=2;
最终int 3月=3;
最终int 4月=4;
最终整数=5;
6月最后一次int=6;
最终int 7月=7;
最终int 8月=8;
最终int 9月=9;
10月的最后整数=10;
11月最后一次国际贸易=11;
12月最后一次国际贸易=12;
最终int压延机_MAX=12;
扫描仪sc;
字符串计算;
字符串重复;
字符串用户名;
int生日;
线绳垃圾;
国际青年组织;
国际日;
内月=1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
积分=0;
字符串summer=“summer”;
字符串秋=“秋”;
字符串winter=“winter”;
字符串spring=“spring”;
字符串seasureborn=“任意季节”;
String monthBorn=“任何月份”;
字符串snakeyearmg=“年份”;
布尔蛇耳环;
布尔haveS;
双生日;
字符首字母;
//节目开始
System.out.println(“”);
System.out.println(“”);
System.out.println(“Sammy Snakes成功的第六春/第七春”);
System.out.println(“”);
System.out.println(“”);
System.out.println(“”);
System.out.println(“我可以为您计算Ess分数”);
System.out.println(“您想计算Ess分数吗?”);
System.out.println(“”);
sc=新扫描仪(系统英寸);
essscorecalculate=sc.nextLine();
{
/*esscore.Reset*/
{
}
}
System.out.println(“”);
System.out.println(“首先,你叫什么名字?”);
System.out.println(“”);
用户名=sc.nextLine();
initial=(userName.charAt(0));
{
如果(初始值=='S')
essscore=+4;
如果(初始值=='s')
essscore=+4;
}
System.out.println(“”);
System.out.println(“您出生的年份?(请按以下格式输入XXXX)”;
System.out.println(“”);
生日=sc.nextInt();
垃圾=sc.nextLine();
{
{
如果(生日==蛇年)
snakeYearBool=真;
/*essscore=+16;*/
否则如果(生日!=蛇年)
snakeYearBool=假;
}
{
if(snakeYearBool=false)
snakeYearMsg=“非蛇年”;
if (((birthYear - 9) %12) == 0)
if (birthYear == SNAKE_YEAR)
if (snakeYearBool == false)
snakeYearMsg = "A non Snake year";
if (snakeYearBool == true)
snakeYearMsg = "Snake year";