0% found this document useful (0 votes)
26 views

SSK3101 - Lab Assignment 14: Recursion. Due: 1 June - at End of Lab Hour

This document provides instructions for a recursive lab assignment to write an application that computes powers of any number using recursion. The application takes two double arguments from user input - a number and an exponent - and returns a double value. It must support both positive and negative exponents by using the formula xn = xn-1 * x for positive exponents and x-n = x(1/n) for negative exponents. Students must complete and demo the assignment during the lab session or risk point deductions, and are reminded that academic integrity is required.

Uploaded by

rockers91
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

SSK3101 - Lab Assignment 14: Recursion. Due: 1 June - at End of Lab Hour

This document provides instructions for a recursive lab assignment to write an application that computes powers of any number using recursion. The application takes two double arguments from user input - a number and an exponent - and returns a double value. It must support both positive and negative exponents by using the formula xn = xn-1 * x for positive exponents and x-n = x(1/n) for negative exponents. Students must complete and demo the assignment during the lab session or risk point deductions, and are reminded that academic integrity is required.

Uploaded by

rockers91
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 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