subject

1) Create a method Sum to include a FOR loop. 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() 2) Create another method: Factorial that calculates a Product of same numbers, that Sum does for summing them up. Make sure you use FOR loop in it. 3) Make a switch that Calls either sum(...) method OR factorial(...) method, depending on what user of the program wants. Ask the user to enter a selection, after the number is entered, such as "do sum" or "do factorial", read it with the Scanner next(), then call the appropriate method in a switch.

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 12:00, anamatiascamaja
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
image
Computers and Technology, 24.06.2019 00:50, sequoyaburke
Which player type acts on other players? a. killer b. achiever c. explorer d. socializer
Answers: 1
image
Computers and Technology, 24.06.2019 11:40, girdwood6678
100 pts. first person gets brainliest
Answers: 2
image
Computers and Technology, 24.06.2019 22:30, jadelovell21
The a great imaginary circle, or reference line, around earth that is equally distant from the two poles and divides earth into the northern and southern hemispheres.
Answers: 1
You know the right answer?
1) Create a method Sum to include a FOR loop. Get a scanner and input a number form the keyboard in...

Questions in other subjects:

Konu
English, 09.09.2021 14:00
Konu
English, 09.09.2021 14:10