Import java.util.*
Import java.io.*
/**
* <p>title: Callout input Output </p>
* <p> Description: Receives standard keyboard input, and outputs to the screen. </p>
* <p>copyright:copyright (c) 2003</p>
* <p>Filename:standerdIO.java</p>
* @version 1.0
*/
public class standerdio{
/**
*<br> Method Description: Main method
*<br> input parameters:
*<br& gt; return type:
*/
public static void Main (string[] args) {
Vector vtemp = new vector ();
Boolean flag = true;
while (flag) {
System.out.print ("input>");
String stemp = "";
//Read input, system.in means receive keyboard input stream
BufferedReader stdin = new BufferedReader (new InputStreamReader (system.in));
try{
//read one line of input
Stemp = Stdin.readline ();
}catch (IOException IE) {
System.err.println ("IO error!");
}
//Parse input command
String scmd= "";
String scontext= "";
int point = Stemp.indexof (":");
if (point==-1) {
Scmd = Stemp.trim ();
}else{
Scmd = stemp.substring (0,point);
Scontext = stemp.substring (point+1);
}
//Add Data
if (Scmd.equalsignorecase ("in")) {
if (scontext.equals ("")) {
System.err.print ln ("This command format is errer!");
}else{
Vtemp.addelement (scontext);
}//View Results
Else if (scmd.equalsignorecase ("Out")) {
for (int i=0;i<vtemp.size (); i++) {
Syste M.out.println (i+ ":" +vtemp.elementat (i));
}
}//End
Else if (Scmd.equalsignorecase ("Quit")) {
Flag=false;
else{
System.err.println ("This command don´t run!");
System.out.print ("Use:in:command");
System.out.print ("Use:out");
}
}
}
}