As title states, have a bit of an issue reading things correctly. The catch here is that I am reading only a bit of the file outside of a while loop, and the rest inside. I think that works fine because a piece of the file is read into every conditional.
Here is my code:
(rest of the code isn't pasted in for conciseness)
Scanner infp = new Scanner(new File("customerdata.txt"));
int timeEntered = infp.nextInt();
System.out.println(timeEntered);
while (infp.hasNext()) {
if (timeEntered == clock)
{
String type = infp.next();
int itemNum = infp.nextInt();
if (type.equals("REFUND"))
{
itemPrice = infp.nextDouble();
}
}
}
My InputMismatchException error occurs at int itemNum = infp.nextInt();
.
Notice, by now I have successfully read the String type
. At first my idea rested in a carriage return but then I remembered that is only the case for user input.
Here is an example of the file being read:
0 R 324 32.53
Any and all help is appreciated.