GeeCON Prague 2014*
The moose likes Beginning Java and the fly likes Confused on how to set-up my getter and setter methods. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Confused on how to set-up my getter and setter methods." Watch "Confused on how to set-up my getter and setter methods." New topic
Author

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

Mack Grill
Greenhorn

Joined: Feb 27, 2012
Posts: 29

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

Joined: Feb 26, 2001
Posts: 4474
    
    6

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)


Junilu - [How to Ask Questions] [How to Answer Questions]
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 561
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?


Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
 
GeeCON Prague 2014
 
subject: Confused on how to set-up my getter and setter methods.