• 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

Anyone willing to look at this code

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am supposed to call a method based upon the input of the user.
Then I need to return the a value based upon the calculation done in that method. I am very new to Java and having great difficulty understanding the concept of methods passing values and returning values. Thanks for any insight.

[ October 07, 2006: Message edited by: Bear Bibeault ]
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

package lab03;



hmmm... homework :roll:
 
Ken Terp
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is affirmative. Is that bad?
I guess your response was better than
"Give up!" which is almost what I expected
when posting.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ken Terp:
That is affirmative. Is that bad? ...


It's not bad -- it's just that we won't do people's homework for them. We'll be glad to help, but you need to tell us specifically where you're stuck, and what approaches you've already tried. Then I'm sure we can guide you in the right direction. If your question is a continuation of this previous topic, then I suggest you continue it there, to avoid people answering the same questions under different topics.
[ October 07, 2006: Message edited by: marc weber ]
 
Ken Terp
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I understand and agree. I do not want anyone to do it for me. I simply
need help with methods, passing and returning values to them as well as calling methods from other methods. I have put in well over 40 hours into this program and have hit a wall. Again by posting the code my intention was not for someone to do it for me. I just need help and that is also why I asked if anyone would be willing to look at it. It seems many of you have forgotten about the help you got when you first started to learn to program in Java. Very friendly place this is.
 
marc weber
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ken, I think most of us understand your frustration, and we do want to help. I also realize that another rancher wasn't very tactful in a separate thread, and that probably just adds to the frustration.

So, as I suggested in your other thread, if you still have questions about the topic in your other thread, please try continuing the discussion there (where someone else has just posted a helpful note regarding scope). Or if you have a separate question on this project, please be more specific here.

Thanks!
[ October 07, 2006: Message edited by: marc weber ]
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yep ! I am pretty confused about where you need help when there are so many threads running about. If you post what you need in one single thread you are bound to get better responses for sure. Good luck with your assignment and dont give up
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ken,

you wrote that you are

having great difficulty understanding the concept of methods passing values and returning values.





As I do not really know what the understanding problem is, I can only advice to search for java tutorials and about invoking methods.
You can search for the java tutorials at sun.com, or here on the java ranch.
But the best thing to do is to visit your local library and borrow a book about Java fundamentals.
OK, library may be closed on sundays.


But as method invoking may be the bottle neck in the moment, leave your own example for a moment and play around with easier examples as the following:






Basically, a method is made out of the following elements:
example as above



Additionally a method signature can have access modifiers, other modifiers (eg The Big One: static) and errors to be thrown, but you should leave this out (ok, except static) for the moment.

The next topics to look at would be overriding and overloading.



Yours,
Bu.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic