4.10作业
来源:互联网 发布:好听女装淘宝店铺名字 编辑:程序博客网 时间:2024/04/29 16:31
以下是今天的作业,纠结了很久,结合这几天讲的东西写出来的,大家有意见多提哈
import javax.swing.JOptionPane;
public class tianshu {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String year =JOptionPane.showInputDialog(null,"请输入年份");
String month =JOptionPane.showInputDialog(null,"请输入月份");
String day =JOptionPane.showInputDialog(null,"请输入号数");
int a =Integer.parseInt(year);
int b =Integer.parseInt(month);
int c =Integer.parseInt(day);
int c1=31;
int c2=28;
int c3=29;
int c4=30;
if(b == 1 && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+c+"天");
}
else if(b == 2 && (a%4 == 0) && (c<=29)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1)+"天");
}
else if(b == 2 && (a%4 == 0) && (c<=28)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1)+"天");
}
else if((a%4 == 0) && (b == 3) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3)+"天");
}
else if((a%4 != 0) && (b == 3) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2)+"天");
}
else if((a%4 == 0) && (b == 4) && (c<=30)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1)+"天");
}
else if((a%4 != 0) && (b == 4) && (c<=30)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1)+"天");
}
else if((a%4 == 0) && (b == 5) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1+c4)+"天");
}
else if((a%4 != 0) && (b == 5) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1+c4)+"天");
}
else if((a%4 == 0) && (b == 6) && (c<=30)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1+c4+c1)+"天");
}
else if((a%4 != 0) && (b == 6) && (c<=30)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1+c4+c1)+"天");
} else if((a%4 == 0) && (b == 7) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1+c4+c1+c4)+"天");
}
else if((a%4 != 0) && (b == 7) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1+c4+c1+c4)+"天");
} else if((a%4 == 0) && (b == 8) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1+c4+c1+c4+c1)+"天");
}
else if((a%4 != 0) && (b == 8) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1+c4+c1+c4+c1)+"天");
}
else if((a%4 == 0) && (b == 9) && (c<=30)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1+c4+c1+c4+c1+c1)+"天");
}
else if((a%4 != 0) && (b == 9) && (c<=30)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1+c4+c1+c4+c1+c1)+"天");
} else if((a%4 == 0) && (b == 10 && (c<=31))){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1+c4+c1+c4+c1+c1+c4)+"天");
}
else if((a%4 != 0) && (b == 10) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1+c4+c1+c4+c1+c1+c4)+"天");
}
else if((a%4 == 0) && (b == 11) && (c<=30)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1+c4+c1+c4+c1+c1+c4+c1)+"天");
}
else if((a%4 != 0) && (b == 11) && (c<=30)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1+c4+c1+c4+c1+c1+c4+c1)+"天");
}
else if((a%4 == 0) && (b == 12) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c3+c1+c4+c1+c4+c1+c1+c4+c1+c4)+"天");
}
else if((a%4 != 0) && (b == 12) && (c<=31)){
JOptionPane.showMessageDialog(null, "是"+a+"年的第"+(c+c1+c2+c1+c4+c1+c4+c1+c1+c4+c1+c4)+"天");
}
else{
JOptionPane.showMessageDialog(null,"输入错误");
}
}
}
- 4.10作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业~~~~~~~~~~~~~
- 作业
- 作业
- 作业
- 作业
- 作业
- 作业
- 【APIO2009】【强连通分量】【DAG】抢掠计划
- linux下svn的使用
- JAVA语法糖之自动装箱的陷阱
- 文本协议解析
- TMS320F28335的中断系统——CPU级中断
- 4.10作业
- 树状数组(4)
- ext时间格式的转换 提供三种转换
- 勾股数组
- 重要开源协议的比较(BSD,Apache,GPL,LGPL,MIT) – 整理
- 程序员面试100题之三:不用+、-、×、÷数字运算符做加法
- 网易游戏2011招聘笔试题+答案解析
- map删除
- 悼念512汶川大地震遇难同胞——珍惜现在,感恩生活