Question: 3. Given the following pseudo code, please design an activity diagram that models this code. [7 Marks] Function: Calculate b to the power n (i.e.,

 3. Given the following pseudo code, please design an activity diagram

3. Given the following pseudo code, please design an activity diagram that models this code. [7 Marks] Function: Calculate b to the power n (i.e., b) Input: b (base) and n are integer numbers Output: The result object, which is an integer number Steps: Set result = 1 If b or n is negative values, set the result to -1 and return the result. If n is zero and bis a positive number, set the result to 1 and return the result. If b is zero and n is a positive number, set the result to O and return the result. if b and n are both positive values, Repeat for y timesthe following step. set result = current result * b Return the result. O O

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!