⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 employprotocal.java

📁 《Java TCP/IP应用开发详解》的部分源程序,开发环境为ECLIPSE3.1
💻 JAVA
字号:
package section15;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import sun.awt.image.ImageWatched.Link;

public class EmployProtocal {
    private static final int WAIT=0;
    private static final int REGISTER=1;
    private static final int READY=2;
    private static final int ANSWER=3;
    private static final int OUT=4;
    private static final int END=5;
    private int state=WAIT;
    private int currentQuestion=0;
    private int score=0;
   
  
    private List candidate=new LinkedList();
    private String[] question={"master Java?",
                               "one year+experience?",
                               "master TCP/IP?",
                               "master jsp?",
                               "master servlet?",
                               "master ejb?",
                               "master IDE tools like visual caff...?",
                               "master oracle database?",
                               "master middleware like weblogic...?"};
    private int[]right={5,5,5,1,1,1,2,2,2};                        
    private boolean[]must={true,true,true,false,false,false,false,false,false};
    public String judge(String theInput)
    {
    	boolean isQualidateOrNot=true;
    	String theOutput=null;
    	switch(state)
    	{
    	case WAIT:  theOutput="Register:please input your name.confirm it and press enter key;";
	                state=REGISTER;
	                break;
    	case REGISTER: candidate.add(theInput);
    	            theOutput="hint:you can only press Y or N after you read the question.";
    	            state=READY;
    	            break;
    	case READY: state=ANSWER;
    	            theOutput=question[currentQuestion]+"[Y/N]";
    	            break;
    	case ANSWER:
    		        if(theInput.trim().equalsIgnoreCase("Y"))          
    	              {
    		            score+=right[currentQuestion];
    		            break;
    	              }
    		
    	                           
    	             if(theInput.trim().equalsIgnoreCase("N")&&must[currentQuestion])          
                       {
    	                 state=OUT;
   	                     candidate.remove(candidate.size()-1);
                         isQualidateOrNot=false;
                       }
    	            currentQuestion++;
    	            if(currentQuestion>=question.length)
    	              state=END;  
    	case OUT:  
    	case END:  state=WAIT;
    	               score=0;
    	               currentQuestion=0;
    		           if(isQualidateOrNot)
    		              theOutput="you are indeed we want,your evaluation value is"+score;
    	               else
    	                  theOutput="I am sorry that you'd better get another job!";
    	}
      return theOutput;	
    }
      	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -