public final class IoHelper
extends java.lang.Object
Constructor and Description |
---|
IoHelper()
Creates an instance of IoHelper
|
Modifier and Type | Method and Description |
---|---|
Point2d |
getValidPoint2d()
Returns a valid
Point2d using the console. |
boolean |
isValid(int input,
int minRangeInclusive,
int maxRangeInclusive)
Returns
true if the value is contained in the range. |
int |
readInt()
Reads an int value.
|
int |
writeMessageAndReadInt(java.lang.String message)
Writes a message in the console and tries to read an int.
|
public boolean isValid(int input, int minRangeInclusive, int maxRangeInclusive)
true
if the value is contained in the range.input
- int valueminRangeInclusive
- minimum range includedmaxRangeInclusive
- maximum range includedtrue
if the value is contained in the range.public int writeMessageAndReadInt(java.lang.String message)
message
- message that will be printed in the console outputpublic int readInt() throws java.lang.NumberFormatException
java.lang.NumberFormatException
- if the input is not a number.