Here's what I've changed my code to:
String[] multiplesOfTen = {"", "ten", "twenty", "thirty", "forty", "fifty"};
String[] units = {"", "one", "two", "three", "four", "five", "six",...
Type: Posts; User: ghostheadx
Here's what I've changed my code to:
String[] multiplesOfTen = {"", "ten", "twenty", "thirty", "forty", "fifty"};
String[] units = {"", "one", "two", "three", "four", "five", "six",...
Because I wanted to do it for each integer. I figured I could say that (pseudocode):
if var[0 == num[0] {
System.out.println(words[0])
}
I have one array for digits 1-12 because those are the ones that are expressed in one syllable. I figured I'd store those in the same array so that I could add elements from that onto the second...
I would want it to print the name of the number once, up to 50. So if the number was 55, I guess that's an error. But if the number if 45, I want it to say "forty-five." Basically, I want it to say...
Here are the instructions:
The int t contains an integer between 1 and 50 (inclusive). Write code that outputs the number in words and stores the result in the String inwords. For example, if t is...