I am trying to take the user input using a scanner, and double any number within the userInput. For example: I have no clue what to do 22 should outprint as: I have no clue what to do 44
When I try to use the parseInt I am unsure how to go about it to outprint my result .
public class CopyOfTester
{
public static void main(String args[])
{
boolean Bool = true;
do{
Scanner kbReader = new Scanner(System.in);
System.out.println("Please type in a sentence, or type EXIT to end the program.");
String UserIn = kbReader.nextLine();
if (UserIn.equals("EXIT")){
Bool=false;
}
else{
String sp[] = UserIn.split("\\d+");
sp = UserIn.split(" ");
String lemon;
int nu;
for (int i = 0; i >= sp.length; i++){
nu= Integer.parseInt(sp[i])*2;
nu = nu * 2;
}
System.out.println(nu );
}
}while (Bool == true);
}
}