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

Methods Need help

 
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my updated code with my array according to that, I still don't understand how I am to output the numArray in the  getOperand method to my main method operandsArray

 
Saloon Keeper
Posts: 11054
88
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows ChatGPT
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I merged your stuff with the following thread. I hope that is okay by you.
 
kennith stomps
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I do not understand how I am to output the value of one array in a method to another array in the main method, here is my code thus far.

 
kennith stomps
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is literally insane how hard it is to get such a simple answer
 
kennith stomps
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does anyone on this site know how to do this?
 
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I don't think this will compile, will it?  Line 12 is okay, line 13 is unnecessary, and the variable operands is not declared.  You can do this all on one line:
 
Knute Snortum
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This will work for an array of exactly two elements, but don't you have to return an array of any length?  I believe the instructions give you a hint on how to do that.

[Edit: I didn't see that extra brace in the code.  That's not going to work.  See my comment in the code.]
 
kennith stomps
Ranch Hand
Posts: 274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess nobody knows how to do this
 
Rancher
Posts: 5114
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There has been lots of code posted.  Can you explain what is wrong with the code that has been posted?
If there are errors, copy the full text and paste it here so we can see them.


NOTE: If you are getting compiler error messages, please copy the full text of the messages and paste it here.
 
Greenhorn
Posts: 21
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Kennith, 2 problems with your code.
you need to choose which method is going to instantiate your array of operands.
You have 2 options:
- instantiate the array before calling getOperand(...) in which case you need to pass the array as an argument of getOperand
- instantiate in the method getOperand(...) in which case you need to return the array at the end of getOperand.

At the moment, you are doing both which is confusing.

Secondly, you declare getOperand with a double[] as argument but when you call the method you don't pass the array as argument.




 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic