Question: Write a class called Calculator with the following methods sumRange takes 2 integers, a and b. Input a cannot be negative and must be less

 Write a class called Calculator with the following methods sumRange takes

Write a class called Calculator with the following methods sumRange takes 2 integers, a and b. Input a cannot be negative and must be less than b. The sum of all the integers from a to b inclusively, is returned. If the input fails to meet the specified criteria return 0 findGreatest takes 3 doubles and returns the double with the greatest value factorial takes an integer and returns a long that represents the factorial of the integer. 5! (say "five factorial") 1*2*3*4*5 120 An input of 0 or less should return 0 Write a testing class called CalculatorTester with the following static method selectionMenu takes a Scanner as input and prints the menu shown below. The methods scans the user input and returns what was scanned Enter your selection: 1: Factorial 2: Sum Range 3: FindGreatest 4: Quit Write a main method that does the following . Creates a Scanner and a Calculator .Calls the selectionMenu method to capture user selection Prompt the user for input depending on selection Uses if statements or a switch call the appropriate Calculator method and print the result If the user inputs an invalid selection, print ERROR Uses a loop to repeat this until the user selects quit Example output for input of 1,4 Enter your selection: 1: Factoria1 2: Sum Range 3: Find Greatest 4: Quit Enter an integer 24

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!