0

i want to create a program that would translate number to words from 1-1 billion

this is how i started:

```
package app.runner;
import javax.swing.*;
public class EnglishNumberToWords{
public static void main(String args[]){
int inputNumber=0;
String oness[]={"one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"};
String tens[]={"ten","twenty","thirty","fourty","fifty","sixty","seventy","eighty","ninety"};
String answer="";
String calculate="";
inputNumber=Integer.parseInt(JOptionPane.showInputDialog(null,"PLease Enter a Number: "));
int billion=inputNumber/1000000;
int billion2=inputNumber%1000000;
int billion3=billion*1000000;
int million=billion2/100000;
int million2=billion2%100000;
int million3=million*100000;
int libo = million2/ 1000;
int dalawalibo =million2 % 1000;
int tatlolibo= libo * 1000;
int daan = dalawalibo / 100;
int dalawadaan = dalawalibo % 100;
int tatlodaan= daan * 100;
int ones=dalawadaan/10;
int isa2=dalawadaan%10;
int isa1= ones*10;
if(inputNumber >=0 && inputNumber<=19){
calculate=oness[inputNumber-1];
if(inputNumber>=10 && inputNumber<=19){
calculate=oness[inputNumber-1];
}
}
else if(inputNumber >=20 && inputNumber<=90){
calculate=tens[isa1];
}
JOptionPane.showMessageDialog(null,calculate);
}
}
```

it says array out of bounds exception at line number 45

please guys check my work.. :)

thank you