亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? comprehenquery.java

?? 一個簡單的JAVA程序
?? JAVA
?? 第 1 頁 / 共 3 頁
字號:
    	   return false;
    }    
    
       //The method used to turn the designate day into the weekday
       //Like turn "2004,12,25" into 6(Saturday)
    private String timeToWeek(String year,String month,String day)
    {
       int sum=0;
       int y = Integer.parseInt(year);
       int m = Integer.parseInt(month);
       int d = Integer.parseInt(day);
              
       int[] dayOfMonth = {0,31,28,31,30,31,30,31,31,30,31,30,31};  
      
          //Caculate the first the day of the designate year is "Xing Qi Ji"
       int firstDayOfYear = firstDay(y);
            
       for(int i = 1;i < m;i++)
        {
           sum=sum+dayOfMonth[i];
        }
      
       sum = sum+(d-1)+firstDayOfYear;

          //If month is over February and the designate year is leap year,
          //the total days should be add one 
       if( (m >= 2) && ((y%4 == 0 && y%100 != 0) || (y%400 == 0)))
          sum ++;
          
       int week = 0;  
          //The weekday for the designate day is: 
       int x = sum % 7;       
       switch(x)
         {
          case 1:
             week = 1;
             break;            
          case 2:
             week = 2;
             break;
          case 3:
             week = 3;
             break;
          case 4:
             week = 4;
             break;
          case 5:
             week = 5;
             break;
          case 6:
             week = 6;
             break;
          case 0:
             week = 7;
             break;
         } 
         
       return String.valueOf(week);                  	    
    }
    
       //The method used to caculate the first the day of the designate year is "Xing Qi Ji"
    private int firstDay(int year)
    {
    	int a,b;
    	
	    if(year <= 2000)
	    {
	        a=2000-year;
	        b=6-(a+a/4-a/100+a/400)%7;
	        return b;
	    }
	    else 
	    {
	        a=year-2000;
	        b=(a+1+(a-1)/4-(a-1)/100+(a-1)/400)%7+6;
	        return b%7;
	    }
    }
    
       //The query method for the one way query mode
    public void executeSingleQuery()
    {
    	String sqlString = formSQLString(start,arrive);    	   
    	         
        ResultSet rs = sqlBean.executeQuery(sqlString);
        
        if (rs != null)
	    {
		       //Form result string
	        String result = "                                                    " + 
			                "綜合查詢"; 
			   //Form the specific result string according the message you give       
	        result += formResult(rs,leaveYear,leaveMonth,leaveDay,leaveWeek,start,arrive);    	
	        
	           //Display result in a dialog
	        showResult(result);
	    }	       
	    else 
	       JOptionPane.showMessageDialog(null,"沒有連接上數據庫!",
	                                    "錯誤信息",JOptionPane.ERROR_MESSAGE);           
    }
    
       //The query method for the out and home way query mode
    public void executeDoubleQuery()
    {
    	   //The out and home way has to query the database two times to find the 
    	   //flight infomation of from start city to destination and from destination to start city
    	String sqlString1 = formSQLString(start,arrive);        
        ResultSet rs1 = sqlBean.executeQuery(sqlString1);
        
        String sqlString2 = formSQLString(arrive,start);    	         
        ResultSet rs2 = sqlBean.executeQuery(sqlString2);
        
        if ( (rs1 != null) || (rs2 != null))
	    {
	    	String result = "                                                  " + 
		                    "綜合查詢 ";
			   //Form the result string for the out and home way query mode              
	        result += formDoubleResult(rs1,rs2);    	
	        
	        showResult(result);
	    }
	    else 
	       JOptionPane.showMessageDialog(null,"沒有連接上數據庫!",
	                                    "錯誤信息",JOptionPane.ERROR_MESSAGE);       
    }
    
       //The query method for the mutiple way query mode
    public void executeMutipleQuery()
    {
    	   //The out and home way has to query the database two times to find the 
    	   //flight infomation of from start city to midway destination 
    	   //and from midway destination to final destination
    	String sqlString1 = formSQLString(start,firstArrive);  	         
        ResultSet rs1 = sqlBean.executeQuery(sqlString1);
        
        String sqlString2 = formSQLString(firstArrive,arrive); 	         
        ResultSet rs2 = sqlBean.executeQuery(sqlString2);
        
        if ((rs1 != null) || (rs2 != null))
	    {
	    	String result = "                                                               " + 
		                    "綜合查詢                                                 ";
			   //Form the result string for the mutiple way query mode
	        result += formMutipleResult(rs1,rs2);    	
	        
	        showResult(result);
	    }
	    else 
	       JOptionPane.showMessageDialog(null,"沒有連接上數據庫!",
	                                    "錯誤信息",JOptionPane.ERROR_MESSAGE);        
    }
    
    public String formSQLString(String begin,String end)
    {
    	String sqlString = "SELECT DISTINCT * FROM " + "flight " +    	
						   "WHERE start=" + "\'" + begin + "\'" + " AND " +
			               "destination=" + "\'" + end + "\'";			           	
    	                
    	if (!airFirm.equals("所有"))
    	   sqlString += " AND " + "airFirm=" + "\'" + airFirm + "\'";
    	   
    	return sqlString;
    }
    
       //Get the result string from the result set
    public String formResult(ResultSet rs,String year,String month,String day,
                                          String week,String begin,String end)
    {		
		String result = "";
		   //Change the English weekday into the chinese weekday
		String weekDay = dayOfWeek(week);
		
		result += "\n" + "航程:" + year + "年" + month + "月" + day + "日" +	
		          "(星期" + weekDay + ")  " + begin + "----" + end + "\n"; 
		                  
		result += "航班號    航空公司            起飛地點  抵達地點  起飛時間  抵達時間  " + 
		          "兒童票價   成人票價   折扣   班期 " + "\n";
		     
		   //Used to determine whether there are no records found          
		int originLength = result.length();
		
		String time1,time2;
		String childFare,adultFare,discount1,discount2,seat;
		
		try
		{	
		    String tempResult = "";
		    String tempWeek;
			while(rs.next())
			{			
				tempResult = rs.getString("flight") + rs.getString("airfirm") + rs.getString("start") + 
				             rs.getString("destination");
				             
				   //When you get the time from the resultset,it is like "1200".
				   //So we should change it into the form "12:00".
				time1 = rs.getString("leaveTime");
				time2 = rs.getString("arriveTime");
				   //getTime(String time) is used to change the time form into standard one
				time1 = getTime(time1);
				time2 = getTime(time2);
				
				tempResult += time1 + "     " + time2  + "     ";
				
				   //Make sure that the following items have the exactly bits,
				   //so that they can be display in a neat format	
				childFare = String.valueOf(rs.getFloat("childFare"));
				adultFare = String.valueOf(rs.getFloat("adultFare"));
				discount1 = String.valueOf(rs.getFloat("discount1"));
				discount2 = String.valueOf(rs.getFloat("discount2"));
				seat = String.valueOf(rs.getInt("seat"));
				
				   //Make every item in a neat format
				while(childFare.length() != 11)
				   childFare += " ";
				while(adultFare.length() != 11)
				   adultFare += " ";
				while(discount1.length() != 8)
				   discount1 += " ";						
				   
				tempWeek = rs.getString("week");
		        tempResult += childFare + adultFare + discount1 +
				              tempWeek;
				tempResult += "\n";
				
				   //If the flight schedule contains the day that the user designate,
				   //the record is the just one we find!So put the tempResult to the result!
				   //If not,it is not the result!So can't put the tempResult to the result!
				if (tempWeek.indexOf(week) != -1)
				   result += tempResult;							
			}
		}
		catch(SQLException e)
		{
			e.printStackTrace();
		}
		
		   //Means there are no records found
		   //So give user message that couldn't find correlate infomation
		if (result.length() == originLength)
		{
			result += "                                                    " +
			          "對不起,找不到你想要的航班信息!" + "\n";
		}	
		
		return result;
    } 
    
       //The method used to change the time form 
    private String getTime(String time)
	{
		String time1,time2;
		time1 = time.substring(0,2);
		time2 = time.substring(2,4);
		
		time1 = time1.concat(":");
		time1 = time1.concat(time2);
		
		return time1;
	}
	 
       //The method used to change the English weekday into the chinese weekday
    private String dayOfWeek(String weekNum)
    {
    	String week = "";
    	int num = Integer.parseInt(weekNum);
    	
		switch(num)
		{
			case 1:
             week = "一";
             break;            
          case 2:
             week = "二";
             break;
          case 3:
             week = "三";
             break;
          case 4:
             week = "四";
             break;
          case 5:
             week = "五";
             break;
          case 6:
             week = "六";
             break;
          case 7:
             week = "日";
             break;
		}
		
		return week;
    }   
    
       //Form the result string for the out and home way query mode 
    public String formDoubleResult(ResultSet rs1,ResultSet rs2)
    {
    	String result1 = formResult(rs1,leaveYear,leaveMonth,leaveDay,leaveWeek,start,arrive);
    	String result2 = formResult(rs2,backYear,backMonth,backDay,backWeek,arrive,start);
    	
    	String result = result1 + result2;
    	return result;
    }
    
       //Form the result string for the mutiple way query mode
    public String formMutipleResult(ResultSet rs1,ResultSet rs2)
    {
    	String result1 = formResult(rs1,leaveYear,leaveMonth,leaveDay,leaveWeek,start,firstArrive);
    	String result2 = formResult(rs2,leaveYear2,leaveMonth2,leaveDay2,leaveWeek2,firstArrive,arrive);
    	
    	String result = result1 + result2;
    	return result;
    }
    
       //Show the result in a dialog
    public void showResult(String result)
    {
    	JOptionPane.showMessageDialog(null,result,"查詢結果",JOptionPane.PLAIN_MESSAGE);
    }         
}///:~

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产亲近乱来精品视频| 国产三级精品三级| 在线看国产一区二区| 成人国产精品免费观看| 国产ts人妖一区二区| 国产福利电影一区二区三区| 国产精品综合久久| 成人激情黄色小说| 99国产精品久久| 欧美性大战久久久| 欧美猛男gaygay网站| 日韩欧美一二区| 亚洲成av人片www| 亚洲制服丝袜一区| 亚洲电影你懂得| 国产高清一区日本| 国产大片一区二区| 高清国产一区二区| 99精品视频中文字幕| 欧美性大战久久久| 精品免费99久久| 中文字幕一区二区三| 亚洲午夜免费福利视频| 裸体健美xxxx欧美裸体表演| 国产资源在线一区| 91免费看`日韩一区二区| 欧美美女网站色| 国产片一区二区| 亚洲风情在线资源站| 激情综合网激情| 色综合天天做天天爱| 欧美一区国产二区| 国产精品免费av| 午夜国产精品一区| 99久久免费精品高清特色大片| 91网站在线观看视频| 91精品国产丝袜白色高跟鞋| 日本一区二区三级电影在线观看 | 日韩一区二区三免费高清| 精品国产乱码久久久久久浪潮 | 日本成人中文字幕在线视频| 国产成人在线视频网址| 欧美日本在线看| 日本一区二区综合亚洲| 日韩和欧美一区二区三区| 成人精品免费网站| 日韩一级片在线播放| 亚洲精品久久久久久国产精华液| 国模娜娜一区二区三区| 欧美精选午夜久久久乱码6080| 国产精品免费丝袜| 国产成人午夜视频| 精品区一区二区| 午夜视频在线观看一区二区三区| 成人免费高清在线| 久久色在线视频| 日本免费新一区视频| 欧美日韩久久不卡| 日韩毛片精品高清免费| 国产不卡视频一区二区三区| 日韩片之四级片| 日韩成人一区二区三区在线观看| 一本大道久久a久久精品综合| 国产欧美日产一区| 懂色av中文一区二区三区| 欧美成人精品1314www| 青娱乐精品视频| 欧美精品亚洲一区二区在线播放| 亚洲午夜精品在线| 欧美性色综合网| 亚洲国产精品嫩草影院| 色婷婷香蕉在线一区二区| 亚洲人成网站在线| 色综合视频一区二区三区高清| 久久久久成人黄色影片| 国产美女av一区二区三区| 久久免费国产精品| 成人精品gif动图一区| 亚洲欧美在线视频| 色噜噜狠狠成人网p站| 一区二区三区四区在线免费观看 | 色美美综合视频| 亚洲欧美另类久久久精品| 色香蕉成人二区免费| 亚洲.国产.中文慕字在线| 欧美日韩一区久久| 九色porny丨国产精品| 久久香蕉国产线看观看99| 国产精品亚洲成人| 成人免费一区二区三区在线观看| 91麻豆国产福利精品| 婷婷一区二区三区| 久久影院午夜论| 99久久免费国产| 五月天久久比比资源色| 精品精品国产高清一毛片一天堂| 国产成人在线观看免费网站| 专区另类欧美日韩| 在线播放中文字幕一区| 国产91精品一区二区麻豆网站 | 亚洲视频电影在线| 欧美日韩在线观看一区二区| 久久机这里只有精品| 国产精品三级久久久久三级| 欧美亚洲图片小说| 国产精品18久久久久| 一区二区三区在线免费播放| 欧美岛国在线观看| 91蜜桃网址入口| 精品一区二区久久久| 亚洲欧美另类图片小说| 精品久久人人做人人爽| 色网站国产精品| 国产一区二区三区高清播放| 一区二区三区精品| 久久久久国产免费免费| 欧美日韩精品一区二区三区四区 | 亚洲精品欧美综合四区| 欧美刺激脚交jootjob| 色综合久久天天综合网| 久久精品国产999大香线蕉| 玉米视频成人免费看| 国产亚洲一区二区三区四区| 91精品欧美一区二区三区综合在 | 人人狠狠综合久久亚洲| 亚洲欧洲日韩综合一区二区| 日韩一区二区中文字幕| 欧洲精品一区二区| 99久久精品国产毛片| 国产精品一区免费在线观看| 日韩不卡免费视频| 亚洲成人高清在线| 亚洲男同性视频| 国产精品短视频| 欧美韩日一区二区三区四区| 久久夜色精品国产欧美乱极品| 欧美日韩午夜影院| 欧美天堂亚洲电影院在线播放| 99v久久综合狠狠综合久久| 福利一区二区在线| 国产资源在线一区| 国产在线麻豆精品观看| 麻豆国产欧美日韩综合精品二区 | 7777精品伊人久久久大香线蕉最新版| 99国产精品99久久久久久| jlzzjlzz亚洲女人18| 不卡一二三区首页| www.成人网.com| 91同城在线观看| 99久久免费精品高清特色大片| fc2成人免费人成在线观看播放| 国产精品99久久久久久久vr| 国产一区二区在线观看免费| 国产美女娇喘av呻吟久久| 国产精品影视网| 风间由美中文字幕在线看视频国产欧美| 极品少妇xxxx精品少妇偷拍| 国产一区二区精品久久| 国产成人精品三级麻豆| av电影一区二区| 色婷婷综合激情| 欧美精品久久久久久久多人混战 | 亚洲成人免费看| 日日嗨av一区二区三区四区| 丝袜亚洲精品中文字幕一区| 丝袜亚洲精品中文字幕一区| 麻豆精品一区二区综合av| 国产精品12区| 一本色道久久综合亚洲91| 欧美日韩国产在线播放网站| 制服.丝袜.亚洲.中文.综合| 91精品黄色片免费大全| 精品国产免费一区二区三区四区| 久久精品人人做人人爽97| 午夜免费欧美电影| 欧美aⅴ一区二区三区视频| 韩国在线一区二区| 一本一道波多野结衣一区二区| 欧美精品视频www在线观看| 精品日韩欧美在线| 国产精品国产三级国产专播品爱网 | 欧美性做爰猛烈叫床潮| 欧美一二三区在线观看| 亚洲国产精品国自产拍av| 一区二区在线观看不卡| 日本美女一区二区| 成人性生交大片| 欧美二区在线观看| 亚洲国产精品成人综合色在线婷婷 | 亚洲色欲色欲www在线观看| 日韩av中文字幕一区二区| 成人91在线观看| 日韩一级完整毛片| 亚洲精品视频自拍| 精品一区二区日韩| 欧美三区在线视频| 国产精品三级av在线播放| 丝袜美腿成人在线| 91在线播放网址| 久久综合久久鬼色|