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

📄 catfish.java

📁 curso completo de icarnegie ssd1
💻 JAVA
字号:
public class Catfish {

    /**
     * Fernando Navarro Villeda
	  * Location of the catfish - which column.
     */
    private int column = 1;

    /** 
     * Energy level of catfish
     */
    private int energyLevel = 10;

    /**
     * Location of catfish - the column
     * 
     * @return - an integer representing the column location of catfish.
     */
    public int getColumn() {
    	
    	return column;
	// Student: return the column value

    }

    /**
     *  nada una celda a la derecha incrementando el valor de la columna 1
     */
    public void swimRight() {
    	
    	if(column<10){
    		column = column + 1;
    	}
    	energyLevel = energyLevel - 1;
	//  incrementa el valor de la columna por 1 y
	//  disminuye el valor 
	//  nuevo valor de la columna es mayor o igual a 10.

    }

    /**
     * get the image of catfish
     *
     * @return a String indicating the filename of catfish image
     */
    public String getImage() {
    	
    	if(energyLevel<5)
    	{
    		return "/CatFish-tired.gif";
    	}
    	else
    	{
    		return "/CatFish.gif";
    	}
	// Student: return the image filename that represents the catfish
	// The image of a tired catfish (a catfish with energyLevel less than 5)
	// is "/CatFish-tired.gif".
	//  la imagen  de catfisf cunado no esta cansado es "/CatFish.gif".

    }
}

⌨️ 快捷键说明

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