Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions

Question

Which of these influenced your life most dramatically?

Answered: 1 week ago

Question

What roles have these individuals played in your life?

Answered: 1 week ago