Question: 2. (10 minutes) (15 points) Given two integers a and b, write a recursive method named half which returns how many times a can be

 2. (10 minutes) (15 points) Given two integers a and b,

2. (10 minutes) (15 points) Given two integers a and b, write a recursive method named half which returns how many times a can be halved while still being greater than b. Inside the main method, ask user to enter a and band call the method you have written to print half(a,b). You assume that a>2b. For instance for 624 and 8: 624312156783919.5 79.75 The result will be:6 For 14 and 6: 147 The result will be:1 Example Run 1: Please enter two integers: 624 8 6 Example Run 2: Please enter two integers: 146 1 public static void main(String args) { int a,b; System.out.println("Please enter two integers: "); Scanner console = new Scanner(System.in); a = console.nextInt(); b = console.nextInt(); System.out.println(halla,b))

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!