// Page 224 import java.util.Scanner; public class Prog_14_1 { public static void main(String[] args) { Scanner input=new Scanner(System.in); try { System.out.print("Enter # of donuts: "); int dc = input.nextInt(); System.out.print("Enter # of glasses of milk: "); int mc = input.nextInt(); if(mc < 1) { Exception e = new Exception("Exception: No milk"); throw e; } double dPerGm = dc/(double)mc; System.out.println(dc + " donuts."); System.out.println(mc + " glasses of milk."); System.out.println("\nYou have " + dPerGm +" donuts for each glass of milk.\n\n\n"); } catch (Exception e) { System.out.println("\n\n" + e.getMessage()); System.out.println("Buy some milk.\n\n\n"); } System.out.println("Byebye"); } }