This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Another question printing output Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Another question printing output" Watch "Another question printing output" New topic
Author

Another question printing output

Troy Johnson
Greenhorn

Joined: Sep 24, 2003
Posts: 20
Hello. I just about have this program figured out. However, I am still having a problem getting the display to print out just right. I am pretty close. I am not sure how to add a text statemenet ("is safe") to true and ("is out") to false. Could anyone offer any suggestions or insight. Thanks again.
Here is how I am trying to get the display to look when the program runs:
Team 1 is up to bat:
Jason Crisp (average = 300.0) is out.
Rusty Johnson (average = 170.0) is safe.
Team 2 is up to bat:
Jason Harpham (average = 210.0) is safe.
Kevin McArthur (average = 375.0) is out.
Here is my code:

[ November 05, 2003: Message edited by: Troy Johnson ]
[ November 05, 2003: Message edited by: Troy Johnson ]
[ November 05, 2003: Message edited by: Troy Johnson ]
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

You don't want to print out the retrun from isSafe. You want to use the return from isSafe in an "if" to determine what to print.


Please ignore post, I have no idea what I am talking about.
Tom Blough
Ranch Hand

Joined: Jul 31, 2003
Posts: 263
Look at the ternary operator in Java. It's a condensed version of an if-else statement.


Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

That is not a good example for someone learning java. Standard "if" statements are a better way for people starting out.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Another question printing output
 
Similar Threads
help printing output
Help with toString message
NoSuchMethodError
Counting in Array List/ Standard deviation
One to many Relation