Download A1: Analysis of the Problem

Transcript
Suchana Costa
Calendar Database
else
{
continue;
}
}
}
//This method checks whether or not the data inputed is an integer value, if it is
not, the user is reprompted to enter a valid integer
public static int getCheckedInt(String prompt) throws IOException
{
String data = "";
int x = 0;
for(;;)
{
try
{
System.out.print(prompt);
data = stdin.readLine();
x = Integer.parseInt(data);
break;
}
catch (NumberFormatException error)
{
System.out.println("ERROR: Please enter valid number:");
}
}
return x;
}
}
44