/********************************************************\
IBIO for JETS

This is a simple test program for the IBIO commands
that are mentioned in the JETS documentation for
the OOP Option in the new IB Computer Science course.

Since the IBIO class and all its methods are static,
it's not necessary to instantiate the class
before using the methods.

The JETS documentation is not clear about whether
the IBIO commands will be in a separate class.
In the old syllabus, it was assumed that the methods
are simply part of whatever program is being written,
so they were invoked by simply writing the method name -
writing "input" instead of "IBIO.input".  Either way
might appear in real exam.  Another possibility is to
instantiate an object, e.g.  IBIO com = new IBIO();
and then use that object, e.g.  com.output("test");

In real exams, the actual code inside the IBIO class
will not be written - the input and output commands
will simply be used in the code.  More importantly,
students are not expected to write the IBIO class code
in their answers.

\********************************************************/

public class IBIOtest
{
   public IBIOtest()
   {
      String name = IBIO.input("Type your name:");
      int age = IBIO.inputInt("Type your age:");
      double weight = IBIO.inputDouble("Type your weight:");
      IBIO.output("Your name is " + name);
      IBIO.output("Next year your age will be " + (age + 1));
      IBIO.output("Half your weight is " + (weight / 2));
   }

   public static void main(String[] args)
   {  new IBIOtest(); }
  
  static class IBIO
  {
    static String input(String prompt)
    { return javax.swing.JOptionPane.showInputDialog(null,prompt); }

    static void output(char info)
    { System.out.println(info);   }

    static void output(byte info)
    { System.out.println(info);   }

    static void output(int info)
    { System.out.println(info);   }

    static void output(long info)
    { System.out.println(info);   }

    static void output(double info)
    { System.out.println(info);   }

    static void output(boolean info)
    { System.out.println(info);   }

    static void output(String message)
    { javax.swing.JOptionPane.showMessageDialog(null,message); }

    static String inputString(String prompt)
    { return input(prompt);   }

    static String input()
    { return input("");       }

    static int inputInt()
    {  return inputInt(""); }

    static double inputDouble()
    { return inputDouble(""); }

    static char inputChar(String prompt)
    {  char result=(char)0;
       try{result=input(prompt).charAt(0);}
       catch (Exception e){result = (char)0;}
       return result;
    }

    static byte inputByte(String prompt)
    {  byte result=0;
       try{result=Byte.valueOf(input(prompt).trim()).byteValue();}
       catch (Exception e){result = 0;}
       return result;
    }

    static int inputInt(String prompt)
    {  int result=0;
       try{result=Integer.valueOf(
       input(prompt).trim()).intValue();}
       catch (Exception e){result = 0;}
       return result;
    }

    static long inputLong(String prompt)
    {  long result=0;
       try{result=Long.valueOf(input(prompt).trim()).longValue();}
       catch (Exception e){result = 0;}
       return result;
    }

    static double inputDouble(String prompt)
    {  double result=0;
       try{result=Double.valueOf(
       input(prompt).trim()).doubleValue();}
       catch (Exception e){result = 0;}
       return result;
    }

    static boolean inputBoolean(String prompt)
    {  boolean result=false;
       try{result=Boolean.valueOf(
       input(prompt).trim()).booleanValue();}
       catch (Exception e){result = false;}
       return result;
    }
  }
}