Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Confused on how to set-up my getter and setter methods.  RSS feed

 
Mack Grill
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

My instructions state:

"Create setProjectScore() and setQuizScore() methods for the arrays. These should only take a double as a parameter and an int as a project or quiz number. These methods should return a boolean to indicate success or failure, depending on if the project or quiz number is out of the bounds of the array. The setProjectScore() and setQuizScore() methods will place the double value into the project or quiz number index of its respective array."

I believe I have the parameter written out correctly but I am not sure how if 'int' should be inside the parameter or inside the body of the method.

This is all that I have:



 
Junilu Lacar
Sheriff
Posts: 10880
158
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These are covered by the Java Tutorials - http://docs.oracle.com/javase/tutorial/java/javaOO/returnvalue.html and http://docs.oracle.com/javase/tutorial/java/javaOO/arguments.html

Next time please SearchFirst (<--click)
 
Greg Brannon
Bartender
Posts: 563
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take it a step at a time:
These (methods) should only take a double as a parameter and an int as a project or quiz number.

Is that what the method you've posted does?
These methods should return a boolean to indicate success or failure, depending on if the project or quiz number is out of the bounds of the array.

What does the method you posted return? Is what you posted a valid method signature?
The setProjectScore() and setQuizScore() methods will place the double value into the project or quiz number index of its respective array.

Does the method you posted do as described?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!