I have a program which tells the user to input three ints and converts each one to a string. I.e 1 = one ; ...etc. The problem here is defining the ints for every user input. How can i get it with just one input and loop it to take another, considering to separate inputs so we can use it individually in every phrase down here.
public static void main(String[] args) {
String[] i = { "zero" , "one" , "two" , "three" , "four" ,
"five", "six", "seven" , "eight" , "nine" , "ten" };
Scanner in = new Scanner(System.in);
System.out.println("I have ..... Networking books, ..... Database books, and ..... Programming books. ");
String text = "" , text1 = "", text2 = "" ;
// loop i/p and using it in every phrase seperatellty
for (int a = 1; a <= 1; a++) {
int word = in.nextInt();
int word1 = in.nextInt();
int word2 = in.nextInt();
text = i[word];
text1 = i[word1];
text2 = i[word2];
}
System.out.println("I have " + text + " Networking books, "
+ text1 + " Database books, and "
+ text2 +" Programming books. ");
}}