import java.util.ArrayList; import java.util.Scanner; class Main { public static void main(String[] args) { // List containing the islands, we use the ArrayList provided by the Java libraries ArrayList islands = new ArrayList(); // Coordinates of point we want to check if it is on an island int px = 0, py = 0; // Create scanner to read in values Scanner scanner = new Scanner(System.in); while (scanner.hasNext()) { String cmd = scanner.next(); if (cmd.equals("insert")) { // Add new island //TODO implement this } else if (cmd.equals("onisland")) { // Check if point is on an existing island // TODO implement this } else if (cmd.equals("draw")) { // Draw islands // TODO implement this } else { System.out.println("Invalid input. terminating..."); break; } //if-else } //while // Close scanner to avoid resource leak scanner.close(); } } /* TEST INPUTS insert cuba 3 100 100 300 100 100 300 insert honolulu 5 350 200 400 300 600 250 550 150 400 100 onisland 500 500 onisland 200 200 onisland 150 150 draw */