// Quiz2.java // // A donut is placed on graph paper centered on the origin. // The inner radius of the donut is 1 inch and the outer radius // is 3 inches (and the graph paper is marked in inches). // Next, a dart is thrown from afar and lands on a point // (x,y) on the graph paper. // Your task: write a Java program which reads in two doubles, // x and y, and prints out whether: // case 1: The point (x,y) lies in the donut hole; or // case 2: The point (x,y) lies in the donut cake; or // case 3: The point (x,y) lies entirely outside the donut. class Quiz2 { public static void main(String[] args) { // your code here! } /////////////////////////////////// // readString, readInt, readDouble /////////////////////////////////// public static String readString() { java.io.InputStreamReader isr = new java.io.InputStreamReader(System.in); java.io.BufferedReader d = new java.io.BufferedReader(isr); try { return d.readLine(); } catch (Exception e) { return "error"; } } public static int readInt() { return Integer.parseInt(readString()); } public static double readDouble() { return Double.valueOf(readString()).doubleValue(); } }