/*中國有句俗語叫“三天打魚兩天曬網(wǎng)”盗蟆。
某人從1990年1月1日起開始“三天打魚兩天曬網(wǎng)”丧凤,
編寫程序判斷這個(gè)人在以后的某天中是“打魚”還是“曬網(wǎng)”愈腾。
要求結(jié)果用“fishing”或“sleeping”表示钦无。*/
import java.util.Scanner;
public class 魚 {
???? public static void main(String[] args) {
????????? System.out.println("請(qǐng)輸入年份");
????????? Scanner inYear=new Scanner(System.in);
????????? int year=inYear.nextInt();????????????????? //輸入年
????????? System.out.println("請(qǐng)輸入月份:");
????????? Scanner inMonth=new Scanner(System.in);
????????? int month=inMonth.nextInt();??????????????? //輸入月
????????? System.out.println("請(qǐng)輸入日:");???????????? //輸入日
????????? Scanner inDay=new Scanner(System.in);
????????? int day=inDay.nextInt();
????????? int addDays=0;
????????? for(int j=1990;j<year;j++)??????? //計(jì)算從1990年到今年1月1日的天數(shù)
????????? {
?????????????? if(((j%4==0)&&!(j%100==0))||(j%400==0)){
??????????????????? addDays+=366;
?????????????? }else{
??????????????????? addDays+=365;
?????????????? }
????????? }
????????? for(int k=1;k<month;k++){
?????????????? switch(k){?????????????????????????????? //以月份作為分支條件极祸,累加天數(shù)
?????????????? case 1:
?????????????? case 3:
?????????????? case 5:
?????????????? case 7:
?????????????? case 8:
?????????????? case 10:
?????????????? case 12:
??????????????????? addDays+=31;??????????????????????????????
??????????????????? break;??????????????????????????????????? //跳出switch語句
?????????????? case 4:
?????????????? case 6:
?????????????? case 9:
?????????????? case 11:
??????????????????? addDays+=30;??????????????????????????????
??????????????????? break;
?????????????? case 2:????????????????????????????????????? //對(duì)于2月,根據(jù)是否為閏年判斷當(dāng)月天數(shù)
??????????????????? if(((k%4==0)&&!(k%100==0))||(k%400==0)){
???????????????????????? addDays+=29;
??????????????????? }else{
???????????????????????? addDays+=28;
??????????????????? }
??????????????????? break;
?????????????? }
????????? }
????????? addDays+=day;???????????? //加上日的天數(shù)
????????? int j=addDays%5;
????????? if(j==1||j==2||j==3){???????? //判斷是捕魚還是曬網(wǎng)
?????????????? System.out.println("fishing");
????????? }else{
?????????????? System.out.println("seelping");
????????? }
???? }
}