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, 22.06.2019 10:00
Create a word problem that involves calculating the volume and surface area of a three-dimensional object. cube: surface area 6 s2 , volume s3
Answers: 3
question
Computers and Technology, 22.06.2019 10:50
Using least squares fitting, you are to fit the data sets to the following models and solve for the parameters ai , where i is the index of the parameter. the input/output data for the systems are linked in the bblearn site. for each of the systems use matlab to plot the supplied data vs. the model fit on one plot. include your code in the solutions. (a) linear fit "lineardata.mat" y=a1x^3 + a2x^2 + a3x + a4 (b) plant fit "plantdata.mat g(s) = a1/(s + a2)
Answers: 1
question
Computers and Technology, 22.06.2019 11:30
Hassan is writing his master’s thesis, which is a thirty-page document. he received some feedback from his professor in the form of comments, but does not see where the comments are. what is the fastest way for hassan to find the feedback?
Answers: 3
question
Computers and Technology, 23.06.2019 08:00
What is a scenario where records stored in a computer frequently need to be checked
Answers: 2
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
Mathematics, 18.09.2019 15:20
question
Chemistry, 18.09.2019 15:20
question
Mathematics, 18.09.2019 15:20
Questions on the website: 13722359