Computers and Technology

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.

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 17:00, naomicervero
Which process would best represent the opposite of exhausting air from a system?
Answers: 2
image
Computers and Technology, 23.06.2019 17:30, Artemis3821
Scientists have changed the model of the atom as they have gathered new evidence. one of the atomic models is shown below. what experimental evidence led to the development of this atomic model from the one before it? a few of the positive particles aimed at a gold foil seemed to bounce back. the colors of light emitted from heated atoms had very specific energies. experiments with water vapor showed that elements combine in specific proportions. cathode rays were bent in the same way whenever a magnet was brought near them.
Answers: 2
image
Computers and Technology, 24.06.2019 01:30, BIKRAMlawati5544
Could you find out how im still getting an 83 percent on this in edhesive a = input("enter an animal: ") s = input ("enter a sound: ") e = "e-i-e-i-o" print ("old macdonald had a farm, " + e) print ("and on his farm he had a " + a + "," + e) print ("with a " + s + "-" + s + " here and a " + s + "-" + s + " there") print ("here a " + s+ " there a " + s) print ("everywhere a " + s + "-" + s ) print ("old macdonald had a farm, " + e)
Answers: 2
image
Computers and Technology, 24.06.2019 09:10, daedae11142
  to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
Do you know the correct 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
Mathematics, 04.09.2021 01:00
Konu
Mathematics, 04.09.2021 01:00
Konu
Chemistry, 04.09.2021 01:00