Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
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
Bartender
Pie
Posts: 7329
45
Android Eclipse IDE IntelliJ IDE Java Linux Mac Scala Spring Ubuntu
 
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic