Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lesson_2;
- public class Frame_2_3_5 {
- public static void main(String[] args) {
- printCoordinates("c", "9");
- }
- static void printCoordinates(String v, String h){
- String str = (getQuadrant(v, h));
- String x = str.substring(0, str.indexOf("_"));
- String y = str.substring(str.indexOf("_") +1 );
- System.out.println(v + h + ":" + "(" + x + "px; " + y + "px" + ")");
- }
- static String getQuadrant(String v, String h){
- String result = "";
- int indexX = Integer.valueOf(h);
- int indexY = 1;
- if (v == "a") {
- indexY = (indexY-1)*64;
- } else if (v == "b"){
- indexY = 2;
- indexY = (indexY-1)*64;
- } else if (v == "c"){
- indexY = 3;
- indexY = (indexY-1)*64;
- } else if (v == "d"){
- indexY = 4;
- indexY = (indexY-1)*64;
- } else if (v == "e"){
- indexY = 5;
- indexY = (indexY-1)*64;
- } else if (v == "f"){
- indexY = 6;
- indexY = (indexY-1)*64;
- } else if (v == "g"){
- indexY = 7;
- indexY = (indexY-1)*64;
- } else if (v == "h"){
- indexY = 8;
- indexY = (indexY-1)*64;
- } else if (v == "h"){
- indexY = 8;
- indexY = (indexY-1)*64;
- }
- result = ((indexX-1)*64) + "_" + indexY;
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement