The program needs to count and display the number of times that the specified charector appears in the text file.
Currently turning up zero for the total. I\'m not i
This answer is assuming each line in your text file contains just one letter as your question suggests.
You need to wrap your if statement in a loop as currently you are only checking the first line of the file:
while(inputFile.hasNext()) {
if (inputFile.nextLine().equalsIgnoreCase(letter)) {
count++; // add letter occurrence
total += count; // add the letter occurrence to the total
}
}
Also you can replace:
count++;
total+= count;
with just
total++;