reset password
Author Message
304374842
Posts: 56
Posted 14:03 Aug 30, 2016 |

For the first lab do you want the methods to be called from the main method, from the method that creates the array or from the print method? 

dcacere4
Posts: 10
Posted 14:46 Aug 30, 2016 |

I believe he wants you to use main to call the print method to print the various arrays

jhurley
Posts: 207
Posted 17:54 Aug 30, 2016 |
dcacere4 wrote:

I believe he wants you to use main to call the print method to print the various arrays

Yes, this is correct

jkang
Posts: 33
Posted 15:31 Aug 31, 2016 |

Does print method have to be used from main() for all the methods? 

Some of the directions say the method itself should print.

Are each of the methods using the original array?

 

jhurley
Posts: 207
Posted 18:28 Aug 31, 2016 |
jkang wrote:

Does print method have to be used from main() for all the methods? 

Some of the directions say the method itself should print.

Are each of the methods using the original array?

 

Each time you print the array, do so by calling the print method from main().  The square root method outputs some data that is different from the array, so it needs its own output.  Even after that one, though, print the original array using the print method.

The methods other than main and the input method should each take the array as an argument.

epascua
Posts: 47
Posted 16:35 Sep 01, 2016 |
jhurley wrote:
jkang wrote:

Does print method have to be used from main() for all the methods? 

Some of the directions say the method itself should print.

Are each of the methods using the original array?

 

Each time you print the array, do so by calling the print method from main().  The square root method outputs some data that is different from the array, so it needs its own output.  Even after that one, though, print the original array using the print method.

The methods other than main and the input method should each take the array as an argument.

So basically you print the original array (using the print method) after running the other methods (that change the array) to show whether it effects the original array or not?

Also, for the one that changes the value of the array to 500 if greater then 500 are you changing the actual values of the original array? And if so, when you print the last array in the end with the original, will the original array be the same as the "change 500 if greater then 500" array or would it be the intial values the user has input?

Thanks!

jhurley
Posts: 207
Posted 16:44 Sep 01, 2016 |
epascua wrote:
jhurley wrote:
jkang wrote:

Does print method have to be used from main() for all the methods? 

Some of the directions say the method itself should print.

Are each of the methods using the original array?

 

Each time you print the array, do so by calling the print method from main().  The square root method outputs some data that is different from the array, so it needs its own output.  Even after that one, though, print the original array using the print method.

The methods other than main and the input method should each take the array as an argument.

So basically you print the original array (using the print method) after running the other methods (that change the array) to show whether it effects the original array or not?

Also, for the one that changes the value of the array to 500 if greater then 500 are you changing the actual values of the original array? And if so, when you print the last array in the end with the original, will the original array be the same as the "change 500 if greater then 500" array or would it be the intial values the user has input?

Thanks!

Yes and yes. 
Print out the array values each time and make sure that they change when they should and do not change when they should not.
The replace-values-over-500 method should change values in the original array (if there are any greater than 500).

nikita.a
Posts: 4
Posted 17:59 Sep 01, 2016 |

If the original array is affected by the replace over 500 method, does that mean the method that copies the array and replaces it with its reciprocal is also affected by the replace over 500 method or not?

jhurley
Posts: 207
Posted 18:02 Sep 01, 2016 |
nikita.a wrote:

If the original array is affected by the replace over 500 method, does that mean the method that copies the array and replaces it with its reciprocal is also affected by the replace over 500 method or not?

yes, if you call the methods in the order shown in the assignment, you'll be copying the array after the values over 500 have been replaced, so the new values are the ones that you will copy