You are on page 1of 1

SSK3101 Lab Assignment 14

Recursion. Due: 1st June at end of lab hour


Write a recursive application to compute powers of any number. The application takes two arguments of type double from the users input and returns a value of type double. In addition, it should also allow for negative exponents. The definition of power is based on the following formula for each positive and negative exponent respectively. xn is equal to xn-1 * x x n is equal to x (1/n) Example: 3.0 to the power of 3.0 is 27.0 5.0 to the power of -3.0 is 0.008

Note: (1) To ease your programming effort, refer to the Java API. (2) This assignment must be completed and submitted to the demo at the end of lab session. Failure to do so will cause points to be deducted. ACADEMIC INTEGRITY Copying or other forms of cheating is forbidden. The faculty has very strong rules about this, and the standard penalty for the offence is to award 0 marks to all parties concerned.

You might also like