Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Puzzled

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm writing the assignment Java-4(Say) and I can't get the correct output for nos 11-19, I've got all the rerst to print-out correctly but everytime i try to get 11-19 to printout I can't I've tried an if statement, an if-else statement,a while statemnt and a do-while statment and am running out of ideas. I haven't used a for loop because it doesn't have to loop round
 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't Worry I was using wrong operators, I've sorted it out now
 
Ranch Hand
Posts: 375
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post your code using CODE tags and expected output and we can have a look

EDIT: OK...
[ March 29, 2005: Message edited by: Kashif Riaz ]
 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here' s the program I am using JOptionPane to get the input because I'm using either NetBeans or JCreator
 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it wrong. The output is fine if I take out the System.exit(0) for the If statment but if i enter 12 I get
Twelve
Ten
Two
 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think your if condition is wrong
it should be if (no >10 && no <20 ) instead of if (no >10 || no >20 )

Hope this helps
Thanks
Kareem
[ March 29, 2005: Message edited by: Kareem Qureshi ]
 
Iain Palmer
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you it works I thoght it had to be something simple but I just couldn't see. Sorry for the late reply but have been busy.
 
Forget Steve. Look at this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic