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

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 14:00
Rint "censored" if userinput contains the word "darn", else print userinput. end with newline. #include #include using namespace std; int main() { string userinput; userinput = "that darn cat."; /* your solution goes here */ return 0; }
Answers: 1
question
Computers and Technology, 22.06.2019 13:00
Why the bear has a slunky tail determine the meaning of the word slunk in the story
Answers: 1
question
Computers and Technology, 22.06.2019 16:10
When copying and pasting text, the first step is move your cursor type the text select the copy command select the paste command
Answers: 2
question
Computers and Technology, 24.06.2019 16:30
You may see the term faq on websites which stands for frequently asked questions this is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation ken has dipped many dark chocolate marshmallows (which you remember the metric system distance units in decreasing order: kilometers, hectometer, decameter, centimeter, millimeter) is an example of which type of mnemonic? a) poem b) acronym c) acrostic d) abbreviation !
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
question
Biology, 03.12.2020 19:00
question
Mathematics, 03.12.2020 19:00
question
Computers and Technology, 03.12.2020 19:00
question
Mathematics, 03.12.2020 19:00
Questions on the website: 13722367