锘??xml version="1.0" encoding="utf-8" standalone="yes"?>中文在线а√在线,久久综合九色综合久久久精品综合 ,成人免费黄色http://www.aygfsteel.com/cisco/category/5583.htmlJava, 涓鏉祿嫻撶殑鍜栧暋浼翠綘鍒版繁澶?lt;br> <span id="dict_daily"> <a target="_blank">Dict.CN 鍦ㄧ嚎璇嶅吀, 鑻辮瀛︿範, 鍦ㄧ嚎緲昏瘧</a> </span> <script language="JavaScript" src="http://dict.cn/daily.php" defer="defer"> </script>zh-cnWed, 28 Feb 2007 07:05:29 GMTWed, 28 Feb 2007 07:05:29 GMT60Release three tiny programs I madehttp://www.aygfsteel.com/cisco/archive/2005/12/04/22391.htmlScott@JAVAScott@JAVASat, 03 Dec 2005 19:33:00 GMThttp://www.aygfsteel.com/cisco/archive/2005/12/04/22391.htmlhttp://www.aygfsteel.com/cisco/comments/22391.htmlhttp://www.aygfsteel.com/cisco/archive/2005/12/04/22391.html#Feedback0http://www.aygfsteel.com/cisco/comments/commentRss/22391.htmlhttp://www.aygfsteel.com/cisco/services/trackbacks/22391.htmlJAlarm -- Set your own alarm on PC with the sound you like
Develop under: WinXP + Eclipse 3.1 + SWT 3.1 + JDK 5.0



Download: http://www.cc.puv.fi/~e0300481/download/JAlarm_beta-win32_x86_no_jre.zip
 

WeatherNow - weather display program (Vaasa, Finland only)
Develop under: WinXP + Eclipse 3.1 + SWT 3.1 + JDK 5.0



Download: http://www.cc.puv.fi/~e0300481/download/WeatherNow_beta-win32_x86_no_jre.zip


JNotepad - Java Win Notepad
Develop under: WinXP + Eclipse 3.1 + SWT 3.1 + JDK 5.0



Download: http://www.cc.puv.fi/~e0300481/download/JNotepad_beta-win32_x86_no_jre.zip


Please check the "ReadMe.txt" file for more details, after you unpack the zip file.
Source codes are included together with the application programs, do not hesitate to criticise on my codes, your recommand will make a difference.
Thanks :)

Scott@JAVA 2005-12-04 03:33 鍙戣〃璇勮
]]>
GOOGLE鎸戞垬璧涚粌涔犻1http://www.aygfsteel.com/cisco/archive/2005/12/01/22139.htmlScott@JAVAScott@JAVAThu, 01 Dec 2005 09:49:00 GMThttp://www.aygfsteel.com/cisco/archive/2005/12/01/22139.htmlhttp://www.aygfsteel.com/cisco/comments/22139.htmlhttp://www.aygfsteel.com/cisco/archive/2005/12/01/22139.html#Feedback0http://www.aygfsteel.com/cisco/comments/commentRss/22139.htmlhttp://www.aygfsteel.com/cisco/services/trackbacks/22139.htmlProblem Statement

A simple line drawing program uses a blank 20 x 20 pixel canvas and a directional cursor that starts at the upper left corner pointing straight down. The upper left corner of the canvas is at (0, 0) and the lower right corner is at (19, 19). You are given a string[], commands, each element of which contains one of two possible commands. A command of the form "FORWARD x" means that the cursor should move forward by x pixels. Each pixel on its path, including the start and end points, is painted black. The only other command is "LEFT", which means that the cursor should change its direction by 90 degrees counterclockwise. So, if the cursor is initially pointing straight down and it receives a single "LEFT" command, it will end up pointing straight to the right. Execute all the commands in order and return the resulting 20 x 20 pixel canvas as a string[] where character j of element i represents the pixel at (i, j). Black pixels should be represented as uppercase 'X' characters and blank pixels should be represented as '.' characters.

Definition

Class: DrawLines
Method: execute
Parameters: string[]
Returns: string[]
Method signature: string[] execute(string[] commands)

(be sure your method is public)


鎴戠殑紼嬪簭錛?BR>
public class DrawLines {
    
// current cursor position
    private int xPos, yPos;

    
private int direction;

    
private char[][] canvas;

    
public DrawLines() {
        xPos 
= 0;
        yPos 
= 0;
        
// initial drawing direction downwards
        direction = 270;
        canvas 
= new char[20][20];
    }


    
private void initCanvas() {
        
for (int i = 0; i < 20; i++)
            
for (int j = 0; j < 20; j++)
                canvas[i][j] 
= '.';
    }


    
public String[] excute(String[] commands) {
        initCanvas();
        
for (int i = 0; i < commands.length; i++{
            
if (commands[i].equals("LEFT")) {
                
// when come cross "LEFT", turn 90 degrees couter-clockwise
                direction += 90;
                
if (direction == 360)
                    direction 
= 0;
            }
 else {
                
int len = Integer.parseInt(commands[i].split(" ")[1]);
                
switch (direction) {
                
case 0:
                    
// draw from left to right
                    for (int j = 0; j <= len; j++)
                        canvas[xPos][yPos
++= 'X';
                    yPos
--;
                    
break;
                
case 90:
                    
// draw from down to up
                    for (int j = 0; j <= len; j++)
                        canvas[xPos
--][yPos] = 'X';
                    xPos
++;
                    
break;
                
case 180:
                    
// draw from right to left
                    for (int j = 0; j <= len; j++)
                        canvas[xPos][yPos
--= 'X';
                    yPos
++;
                    
break;
                
case 270:
                    
// draw from up to down
                    for (int j = 0; j <= len; j++)
                        canvas[xPos
++][yPos] = 'X';
                    xPos
--;
                    
break;
                }

            }

        }

        String[] s 
= new String[20];
        
for (int i = 0; i < 20; i++)
            s[i] 
= new String(canvas[i]);
        
return s;
    }


    
public static void main(String[] args) {
        String[] cmds 
= "LEFT""FORWARD 19""LEFT""LEFT""LEFT",
                
"FORWARD 18""LEFT""LEFT""LEFT""FORWARD 17""LEFT",
                
"LEFT""LEFT""FORWARD 16""LEFT""LEFT""LEFT",
                
"FORWARD 15""LEFT""LEFT""LEFT""FORWARD 14""LEFT",
                
"LEFT""LEFT""FORWARD 13""LEFT""LEFT""LEFT",
                
"FORWARD 12""LEFT""LEFT""LEFT""FORWARD 11""LEFT",
                
"LEFT""LEFT""FORWARD 10""LEFT""LEFT""LEFT",
                
"FORWARD 9""LEFT""LEFT""LEFT""FORWARD 8""LEFT",
                
"LEFT""LEFT""FORWARD 7" }
;
        DrawLines drawLines 
= new DrawLines();
        String[] s 
= drawLines.excute(cmds);
        
for (int i = 0; i < 20; i++)
            System.out.println(s[i]);
    }

}


Scott@JAVA 2005-12-01 17:49 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 琼结县| 中卫市| 石首市| 怀集县| 门头沟区| 桓台县| 韶关市| 泸溪县| 宝应县| 和龙市| 诏安县| 甘谷县| 获嘉县| 井陉县| 西盟| 阳朔县| 特克斯县| 佛冈县| 蓝山县| 苏尼特右旗| 铜梁县| 晋州市| 乌兰县| 中卫市| 万山特区| 山丹县| 岚皋县| 雷波县| 扎囊县| 长阳| 嘉祥县| 周口市| 海兴县| 无极县| 汨罗市| 新密市| 卓资县| 常宁市| 郯城县| 丰台区| 资阳市|