• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Another question printing output

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at the ternary operator in Java. It's a condensed version of an if-else statement.
 
William Barnes
Ranch Hand
Posts: 1067
2
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is not a good example for someone learning java. Standard "if" statements are a better way for people starting out.
 
reply
    Bookmark Topic Watch Topic
  • New Topic