Question: continue working on the program about a loop and a sum calculation. Only now your loop should be in a separate method, this method should

continue working on the program about a loop and a sum calculation. Only now your loop should be in a separate method, this method should take a parameter, a number that you enter from the keyboard.

  • need to Create a method getSum to include a FOR loop inside
  • Get a scanner and input a number form the keyboard in main(). The method will take one parameter and calculate the sum up to that number. For example, if you pass 5, it it will calculate 1+2+3+4+5 and will return it back to main() method. Main method should call the method, get the sum back, and print a sum. You call the method from main() and get the result back to main() the method.

Step by Step Solution

3.41 Rating (151 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Certainly Heres an updated version of the program that includes a separate method called ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!