• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

i am struggling with a variable to complete teh code

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am stuck on the last part, . my task is to print all the numbers put into the applications which are smaller than the sum.

the last part is problematic..what the last part should do is count through all the characters in teh string "All", and save the numbers before dot. then convert those numbers and compare them to the average..




(I edited the code so that it isn't three times as wide as my screen -- PC)
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Dmitri, way in which this code has been written is horrible. It becomes very difficult to grasp for the new person ,what is going on in the code and what's the goal of writing code.
Please use proper variable names while writing the code.
Make indentation proper.

Regarding your problem, it looks like you have confused logic in your last for loop. I feel

Should be done if


is something other than a comma(i.e. your variable dot )
that is what I can see from this code.Try it out.
 
Dmitri Makovetskiy
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
could you be clear in how i should rearrange the code.

what should be my if sentence and what in the else sentence?
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where do you define the variable 'sNumber' and what is the data type - a String??

Remember to set 'sNumber' to an empty String after you have used it in else...
 
Rene Larsen
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your above code is now working - if you (as I wrote it my last post) set 'sNumber' to an empty String after you have used it in else (set it inside else).
 
reply
    Bookmark Topic Watch Topic
  • New Topic