How can you detect if a fraction has already been counted? Look at the position in the array of the item being counted? Would there be any of the same fractions before it in the array?
Type: Posts; User: Norm
How can you detect if a fraction has already been counted? Look at the position in the array of the item being counted? Would there be any of the same fractions before it in the array?
You can set the size of the array large enough to hold the data.
You need to use the number of used slots in the array to control the looping through the array.
Remember that the max index will be...
Does fractions[i] have the null value? Why does the code assume it has a valid value?
What is the value of i when the error happens? Does the array have some empty slots in it?
What statement has the variable with the null value? What variable has the null value?
Call hasNextLine() before every call to nextLine()
Hint: the terminating condition in a for loop can have multiple sub parts:
for(int i=0; (i < 10) && (x > 8); i++) {