System.out.printf("You have spent %1$.2f euros and gained ", x);
And if you want a trailing newline, put %n after gained (before " ).