// // // Name: Division.java // // Author: John Wang // Instructor: Dr. Wang // // Goal: Read two reals and output their division, two decimal places // import java.util.Scanner; import java.text.DecimalFormat; public class Division { public static void main(String[] args) { DecimalFormat f2 = new DecimalFormat("0.00"); Scanner kb = new Scanner(System.in); double x1, x2, ans; boolean go = true; // use loops for(int i=0; i<10 && go; i++) { x1 = kb.nextDouble(); x2 = kb.nextDouble(); if(x1>0 && x2>0) { ans = x1 / x2; System.out.println("Your two reals are " + x1 + ", " + x2); System.out.println("Your division is " + f2.format(ans) +"\n\n\n"); //System.out.println("Your display is " + f2.format(2.554)); } else go = false; } } }