package pretzelpalace; /* * Redmond11.java * * Created on April 10, 2003, 01:13 AM */ //import javax.swing.*; import IO.RedmondMsgIn157; import IO.RedmondMsgOut; import java.text.DecimalFormat; /** * * @author mike * @version * Program demonstrates use of RemondMsgIn157 and RedmondMsgOut methods */ public class DemoIOClasses { /** Creates new Redmond11 */ public DemoIOClasses() { } /** * @param args the command line arguments */ public static void main (String args[]) { int age = RedmondMsgIn157.readValidInt("How old are you?",1,100); RedmondMsgOut.display("He claims to be " + age + " years old"); double temp = RedmondMsgIn157.readValidDouble("What is the current temperature (F)",-20.0,120.00); RedmondMsgOut.display("Temperature reported as: " + temp); DecimalFormat twoDec = new DecimalFormat ("0.00"); RedmondMsgOut.display("A little more control on format: " + twoDec.format(temp)); char answ = RedmondMsgIn157.readValidYN("Do you support the right to arm bears?"); RedmondMsgOut.display("Your answer was " + answ); String name = RedmondMsgIn157.readString("What is your name?"); RedmondMsgOut.display("Your name is: " + name); System.exit(0); } }