问题描述
扫描仪控制台=新扫描仪(System.in);
System.out.print(输入生日(dd mm yyyy)老人:);
int days = console.nextInt();
int months = console.nextInt();
int years = console.nextInt();
if((days> = 30&& months> = 9&& years> = 1932)&&(天< = 30&&月< = 9&& years< = 1962))
System.out.println(>> ;>不符合每月支付的条件。原因:符合资格期后的差异);
其他
{
System.out.println(>>>不符合每月付款的条件。原因:不是老人);
}
我尝试过:
大家好,请指教。现在我的问题是我要键入3个数字,其中int天,月,年在单行扫描仪中,但不幸的是,当我按回车键时,程序将在int天数一次键入下一行。
i知道C程序允许在单行输入很多int数,但是java怎么样?谢谢你的建议。
Scanner console = new Scanner(System.in);
System.out.print("Enter birthdate (dd mm yyyy) of elderly: ");
int days = console.nextInt();
int months = console.nextInt();
int years = console.nextInt();
if ((days >= 30 && months >= 9 && years >= 1932) && (days <= 30 && months <= 9 && years <= 1962) )
System.out.println(">>> Not Eligible for monthly payout. Reason: Diasabilities after qualifying period");
else
{
System.out.println(">>> Not Eligible for monthly payout. Reason: Not an elderly" );
}
What I have tried:
Hi all, please advice me. now my problem is i want to key in 3 number which int days, months, years in single line of scanner, but unfortunately when i press enter, program will go to next line once key in number for int days.
i know that C program allow many int number input in single line, but how about the java? thanks for advice.
推荐答案
这篇关于如何在扫描仪类的单行输入日月?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!