I am having issues in converting a boolean value to a String. In my main method,
ID: 3629524 • Letter: I
Question
I am having issues in converting a boolean value to a String.
In my main method, I have:
System.out.printf(" %-13s %9.3f %10s %13.2f", player1.getPlayerName(), player1.getStatistics(), player1.getStatus(), player1.calcCommission());
[and similar codes for players 2-6 that I omitted for space]
Where it will output this picture:
In the status column, I need the "true" to be converted to the String "keep" and "false" as "let go". The getStatus() method returns a boolean type.
How can I do this? If more code is necessary, I can provide. Thank you!
Explanation / Answer
change the getstatus from boolean to String in your method. then put return "true" or return "false"
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.