To understand you requirement correctly -
1. You read data from a file.
2. You check the read line against a
pattern.
3. If the line passes with a pattern, write it to a different file (call "Passed_Input.txt").
4. If the line fails with all the pattern, write it to a different file (call "Failed_Input.txt").
If this is the requirement, then I might write the code like -
1. Form a
regex pattern that will match the input line read from the file.
2. Read the input file line by line and compare against the regex.
3. If it matches add it to a buffer of matched Ids.
4. If it fails add it to a buffer of failed Ids.
5. Write the buffer with matched id's into Passed_Input.txt and the other to the other file.
My first question is, I have to create another 2nd class that will doing different things that current does, or I can solve it with just 3 classes?
To do different things, why you go for a class. You can have different methods that does different things in the same class.
Can you show the classes you have tried so far?