Why are you using tokenizer at all? Have you read its
documentation? What about
The
String "\\+" is a regular expression; you have to escape the + with \\ because + is a meta-character.
Why are you asking for a file name and later checking whether it is the same as a "sales.txt"? That is a bit strange. If you are going to using that file, why are you asking for its name?
Why are you giving the line the name
a and the number the name
line? That is a potent source of confusion. It might be better to call an integer
i.
What happens when you try to get an
int out of a line which contains the + before you split the line?
Why are you using indexOf rather than the contains method on the String?
Why are you reading the line twice in the loop? That is brittle code which depends on the file having + only in odd-numbered lines, and always having an even number of lines.
You appear not to have noted the suggestions I made yesterday. What happened when you tried to create a new Scanner and read from System.in? You will have to read something to see the effect properly.