Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.69 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Chess {
  3.     public static void main(String[] args) {
  4.         Scanner userInput = new Scanner(System.in);
  5.         String label = userInput.nextLine();
  6.         int rank = userInput.nextInt();
  7.         if (label.equals("a") || label.equals("c") || label.equals("e") || label.equals("g")) {
  8.             if (rank % 2 == 0) {
  9.                 System.out.println("dark");
  10.             }
  11.  
  12.         } else if (label.equals("b") || label.equals("d") || label.equals("f") || label.equals("h")) {
  13.             if (rank % 2 >= 0) {
  14.                 System.out.println("dark");
  15.             }
  16.         } else {
  17.             System.out.println("light");
  18.         }
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement