Question: 4 . Create a useful method ( 1 5 s ) 4 . 4 . 1 . Write a method called PrintPowersofn that acce a

4. Create a useful method (15 s)4.4.1. Write a method called PrintPowersofn that acce a base and a maximum exponent as arguments. The method prints each XO01 power of the base from o up to that maximum exponent, inclusive. PrintPowerOfN does not need to return anything. It only displays results on screen. For example: Print PowersOEN (4,3); This calculates 40,41,42, and 4.1/ should output 141664 Print PowersofN (5,6); // should output 1525125625312515625 This calculates 50,51,52,52,54,55, and 56. Print PowersOfN(-2,8); // should output 1-24-816-3264-128256 Both arguments are integers. You may assume that the maximum exponent passed to PrintPowersOfN has a value of 0 or greater. The Math class may help you with this problem! If you use it, you may need to cast its results from double to int so that you don't see a. after each number in your output. You may also write this program without using the Math class. Either solution is acceptable so long as it displays the correct output. 4.4.2. Please use the three sample calls in your submitted program run. 4.4.3. Your program must work for other valid integers besides those listed in the sample calls. 4.4.4. You are welcome to include additional calls, with other values, after these three.

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 Programming Questions!