Hi, Try :
anchorTag.innerHTML = EmpID;
instead of :
anchorTag.setAttribute("innerHTML",EmpID);
Hi, Try :
anchorTag.innerHTML = EmpID;
instead of :
anchorTag.setAttribute("innerHTML",EmpID);
Hi, I suggest using one of these frameworks : ExtJS, Prototype, Dojo, Scriptaculous... It would make it much easier.
Hi vultron, I don't know if you really understand your code. In your code, you clearly defined two points (only two), let's say point A and point B. Coordinates of point A are given by :
int pointOne = 60;
int pointTwo = 120;
Coordinates of point B are given by :
int pointThree = 160;
int pointFour = 140;
Then you draw one side of the snowflake (the side A-B) by :
drawKochSide(g, level, pointOne, pointTwo, pointThree, pointFour);
What you have to do is to define a third point C and to draw the two other sides (B-C) and (A-C), so there's the final code of the paint method :
public void paint(Graphics g)
{
int pointOne = 50; //x coordinate of point A
int pointTwo = 100; //y coordinate of point A
int pointThree = 150; //x coordinate of point B
int pointFour = 100; //y coordinate of point B
int pointFive = 100; //x coordinate of point C
int pointSix = 14; //y coordinate of point C
drawKochSide(g, level, pointOne, pointTwo, pointThree, pointFour);
drawKochSide(g, level, pointFive, pointSix, pointOne, pointTwo);
drawKochSide(g, level, pointThree, pointFour, pointFive, pointSix);
}
Notice that in this example, the triangle ABC is not exactly equilateral because coordinates are integers.
Hi, You can try the Grappa library: http://www.research.att.com/~john/Grappa/ You can download it here
Hello everybody, I would implement it like this to avoid if or switch statements :
int incrementAmount;
for(int i = 0;i < inputLength;i++){
//input[i] gives a "The type of the expression must
//be an array type but it resolved to String", but
//there is no need for '%60'
currentLetter = input.charAt(i);
incrementAmount = (Character.toUpperCase(currentLetter)-'A')%9+1;
firstNameTotal += incrementAmount;
}
Also we can replace :
incrementAmount = (Character.toUpperCase(currentLetter)-'A')%9+1;
By :
incrementAmount = (Character.toUpperCase(currentLetter)-'A')%('J'-'A')+1;
just to be more readable, that means "restart counting after the letter 'J'", which is better than "restart counting after the 9th letter". I also just noticed that you don't manage the case where thirdNameTotal is equal to 0.