Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. package lesson_2;
  2.  
  3. public class Frame_2_3_5 {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. printCoordinates("c", "9");
  8.  
  9. }
  10.  
  11. static void printCoordinates(String v, String h){
  12. String str = (getQuadrant(v, h));
  13. String x = str.substring(0, str.indexOf("_"));
  14. String y = str.substring(str.indexOf("_") +1 );
  15. System.out.println(v + h + ":" + "(" + x + "px; " + y + "px" + ")");
  16. }
  17.  
  18. static String getQuadrant(String v, String h){
  19. String result = "";
  20. int indexX = Integer.valueOf(h);
  21. int indexY = 1;
  22.  
  23. if (v == "a") {
  24. indexY = (indexY-1)*64;
  25. } else if (v == "b"){
  26. indexY = 2;
  27. indexY = (indexY-1)*64;
  28. } else if (v == "c"){
  29. indexY = 3;
  30. indexY = (indexY-1)*64;
  31. } else if (v == "d"){
  32. indexY = 4;
  33. indexY = (indexY-1)*64;
  34. } else if (v == "e"){
  35. indexY = 5;
  36. indexY = (indexY-1)*64;
  37. } else if (v == "f"){
  38. indexY = 6;
  39. indexY = (indexY-1)*64;
  40. } else if (v == "g"){
  41. indexY = 7;
  42. indexY = (indexY-1)*64;
  43. } else if (v == "h"){
  44. indexY = 8;
  45. indexY = (indexY-1)*64;
  46. } else if (v == "h"){
  47. indexY = 8;
  48. indexY = (indexY-1)*64;
  49. }
  50.  
  51. result = ((indexX-1)*64) + "_" + indexY;
  52.  
  53. return result;
  54. }
  55.  
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement