Advertisement
Guest User

Untitled

a guest
Oct 4th, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. package Сlass2_checkPoint3_frame24_32_CYCLES;
  2.  
  3. public class Class2_frame27_TANKS_PrintCoordinates_TASK {
  4.  
  5. public static void main(String[] args) {
  6. printCoordinates("a", "2");
  7. printCoordinates("b", "3");
  8. printCoordinates("h", "1");
  9. }
  10.  
  11. static void printCoordinates(String v, String h) {
  12. System.out.println(v + h + ":" + getQuadrant(v, h));
  13. }
  14.  
  15. static String getQuadrant(String v, String h) {
  16. String vert = "abcdefghi";
  17. String hor = "123456789";
  18. int x = vert.indexOf(v);
  19. int y = hor.indexOf(h);
  20. if (x != 0) {
  21. x = x * 64;
  22. }
  23. if (y != 0) {
  24. y = y * 64;
  25. }
  26. return "(" + x + "px;" + y + "px" + ")";
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement