会计考友 发表于 2012-8-4 12:33:16

2012JAVA模拟试题及答案:编程题14

【程序14】   
题目:输入某年某月某日,判断这一天是这一年的第几天?   
import java.util.*;
public class lianxi14 {
public static void main(String[] args) {
   int year, month, day;
   int days = 0;
   int d = 0;
   int e;
   input fymd = new input();
   do {
   e = 0;
   System.out.print("输入年:");
   year =fymd.input();
   System.out.print("输入月:");
   month = fymd.input();
   System.out.print("输入天:");
   day = fymd.input();
   if (year < 0 || month < 0 || month > 12 || day < 0 || day > 31) {
   System.out.println("输入错误,请重新输入!");
   e=1 ;
   }
   }while( e==1);
      for (int i=1; i
页: [1]
查看完整版本: 2012JAVA模拟试题及答案:编程题14