The exercise instructions here are LONG — please read them all carefully. If you see an internal scrollbar to the right of these instructions, be sure to scroll down to read everything.
Given an integer variable i and a floating-point variable f, that have already been given values, write a statement that writes both of their values to standard output in the following format:
Thus, if i’s value were 25 and f’s value were 12.34, the output would be:
But you don’t know what i’s value and f’s value are. They might be 187 and 24.06. If that’s what their values are, the output from your statement should be:
On the other hand, they might be 19 and 2.001. If that’s what their values are, the output from your statement should be:
Remember: you are GIVEN i and f– that means they are already declared and they already have values! Don’t change their values by assigning or initializing them! Just print them out the way we have shown above. Just write one statement to produce the output.
Remember: in your output you must be displaying both the name of the variable (like i) and its value.
System.out.println("i="+i+" f="+f) ;