public class CUCSApplication { static void main(String[] args) { TokenReader in = new TokenReader(System.in); int a, b, c; System.out.print("please enter a: "); a = in.readInt(); System.out.print("please enter b: "); b = in.readInt(); System.out.print("please enter c: "); c = in.readInt(); System.out.println("you typed in " + a + " " + b + " " + c); // remember to include $in.waitUntilEnter()$ here, at the end, to // prevent the output window from disappearing if you are using // codewarrior pro 3 (the labs use pro 5, so they don't need it) } } try the program above on the following inputs; below, if you provide multiple inputs on one line, then TYPE THEM ALL ON THE SAME LINE before pressing the Enter key. make sure you understand what is happening; you may need to try typing in other inputs to figure it out. ------------------------------------------------------------------------------- 5 6 7 ------------------------------------------------------------------------------- blah 3 3.7 -2 8 ------------------------------------------------------------------------------- blah 3 3.7 -2 8 ------------------------------------------------------------------------------- 3 -2 8 ------------------------------------------------------------------------------- now, change $int a,b,c;$ to $double a,b,c;$ but don't change anything else. try again the sample input sets above. observe that you get the same pattern of problems: $readInt$ requires an int, *even* *though* the variables are declared to be $double$. further observe that it is ok to assign an $int$ value to a $double$ variable: java automatically converts integers to floating point numbers because that is *always* "safe", i.e. never loses any accuracy. however, you may NOT assign a $double$ value to an $int$ variable without explicitly converting --we'll show you how later-- the $double$ value into an $int$: not every floating point number can be converted without loss of accuracy into an integer. ------------------------------------------------------------------------------- now, change all the $readInt$s to $readDouble$s. try again the sample input sets above. observe that $2$ is ok as an input for $readDouble$.