Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA Write a method that takes 2 integer numbers a and b and returns a value of type double. The method returns 0 when either
JAVA
Write a method that takes 2 integer numbers a and b and returns a value of type double.
- The method returns 0 when either of the two parameters is negative.
- The method returns a raised to the power of b if the largest of parameters is a one-digit number (it is in the range [0, 9])
- The method returns a product of a and b if the largest of two numbers is a two-digit number (it is in the range [10, 99])
- The method returns 10000 when the largest of two parameters is a number that has 3 or more digits.
Method header: public static double problem01(int a, int b)
Add Java Doc comments before the method header.
Unit tests for the method are provided.
Sample method calls:
problem01(2, 3) => returns 8.0 problem01(9, 1) => returns 9.0 problem01(9, 0) => returns 1.0 problem01(9, 10) => returns 90.0 problem01(10, 1) => returns 10.0 problem01(22, 10) => returns 220.0 problem01(222, 10) => returns 10000.0 problem01(0, 1000) => returns 10000.0 problem01(-1, 1000) => returns 0.0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started