I am currently working on an assignment and I am stumped on what to do next. I am not asking for you to do it for me I just need help on what to do next. I get an error on the line " number = inFile.nextInt();" and it says java.util.InputMismatchException: null (in java.util.Scanner)
Description: You are to read an external file of random integer values until the end of file is found. As you read the file you should determine how many numbers are less than the value 500 and how many numbers are greater than or equal to 500.
The output I need is: The number of numbers less than 500 is 192 The number of numbers greater than or equal to 500 is 208 The total number of numbers is 400
import java.io.*;
import java.util.*;
public class Prog209a
{
public static void main (String args[])
{
Scanner inFile = new Scanner( "C:\\Users\\Air\\Documents\\java\\p209a.dat");
int number; //number
int Lesser = 0; //count of numbers less than 500
int Greater = 0;//count of numbers greater than 500 or equal to 500
int Count = 0;
while(inFile.hasNext()== true)
{
//input
number = inFile.nextInt();
//decision making
if (number < 500)
Lesser++;
else
Greater++;
Count ++;
}
} }