import java.io.*; public class Simple { public static void main(String[] args) throws IOException { BufferedReader keyIn = new BufferedReader ( new InputStreamReader(System.in),1); String response = "Y"; double first, second; do { System.out.print("Enter the first number: "); first = Double.parseDouble(keyIn.readLine()); System.out.print("Enter the second number: "); second = Double.parseDouble(keyIn.readLine()); if (first > second) { System.out.println("First number (" + first + ") greater"); } else { System.out.println("Second number (" + second + ") greater or equal"); } System.out.println("Sum: " + (first + second)); System.out.println("Product: " + (first * second)); System.out.println("Quotient: " + (first / second)); System.out.println("Difference: " + (first - second)); System.out.println("Remainder: " + (first % second)); System.out.println("Do you want to go again (Y or N) "); response = (keyIn.readLine()).toUpperCase(); }while (!response.equals("N")); }//main }//class ////////////////////////////////New File (Alternative solution)///////////////////// import java.util.*; public class Simple2 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); String response = "Y"; double first, second; do { System.out.print("Enter the first number: "); first = scan.nextDouble(); System.out.print("Enter the second number: "); second = scan.nextDouble(); if (first > second) { System.out.println("First number (" + first + ") greater"); } else { System.out.println("Second number (" + second + ") greater or equal"); } System.out.println("Sum: " + (first + second)); System.out.println("Product: " + (first * second)); System.out.println("Quotient: " + (first / second)); System.out.println("Difference: " + (first - second)); System.out.println("Remainder: " + (first % second)); System.out.println("Do you want to go again (Y or N) "); response = scan.next(); }while (!response.equalsIgnoreCase("N")); }//main }//class