I'm working on an exercise right now which includes taking a text file with numbers in it and translating that to words while using exceptions. When my program would read a number such as "1234" from the text file, it would output "1234: One Two Three Four", I'm making two separate classes, a main class and a numberTranslator class, the main class will contain a method translateNumbersInFile(String filename) and that'll open the filename using Scanner tokenizer and the selected file, and my numberTranslator class will contain the translate() method which will translate the strings to separate integers.
I've never used the Scanner tokenizer before and am unfamiliar with opening files with it. Also, not sure how to split the strings up into the separate numbers. Any help is much appreciated, I'm very lost right now..
Just to add: I need to decompose the number into its individual digits, so translating each digit to its textual representation, and then combine them all with the final text string.
Here are my separate classes, thank you.
package hw05;
import java.io.File;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
}
public translateNumbersInFile(String filename){
}
}
And here's my NumberTranslator class, package hw05;
public class NumberTranslator extends Main {
public String translate(int number){
}
}