what you can do is actually use the next nextLine(); method which takes the whole line the user entered into a string. If you decided to do this, you will have to parse out the irrational numbers you want, which could be cumbersome if you're not familiar with java regex... but it can still be done.
From my experience, the easiest way would be the way i described above. This way, when you prompt the user for the first irrational number, you can save it as a string
-
System.out.println("Enter numerator: ");
-
num = keyboard.nextLine();
-
-
try{
-
String[] firstVal = num.split("/");
-
int val1Num = firstVal[0];
-
int val1Den = firstVal[1];
-
}
-
catch(Exception e){
-
System.out.println("Can not parse number you entered - please try again");
-
}
-
and then you would then do the same for the second irrational number if the first number is successfully parsed.