1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
damaskus [11]
3 years ago
14

A recursive method may call other methods, including calling itself. Creating a recursive method can be accomplished in two step

s. 1. Write the base case -- Every recursive method must have a case that returns a value or exits from the method without performing a recursive call. That case is called the base case. A programmer may write that part of the method first, and then lest. There may be multiple base cases.Complete the recursive method that returns the exponent of a given number. For e.g. given the number 5 and the exponent 3 (53) the method returns 125. Note: any number to the zero power is 1. Note: Do not code for the example. Your method must work for all given parameters! Use this as your method header: public static int raiseToPower(int base, int exponent)
Computers and Technology
1 answer:
liq [111]3 years ago
4 0

Answer:

Explanation:

The following code is written in Java. It creates the raiseToPower method that takes in two int parameters. It then uses recursion to calculate the value of the first parameter raised to the power of the second parameter. Three test cases have been provided in the main method of the program and the output can be seen in the attached image below.

class Brainly {

   public static void main(String[] args) {

       System.out.println("Base 5, Exponent 3: " + raiseToPower(5,3));

       System.out.println("Base 2, Exponent 7: " + raiseToPower(2,7));

       System.out.println("Base 5, Exponent 9: " + raiseToPower(5,9));

   }

   public static int raiseToPower(int base, int exponent) {

       if (exponent == 0) {

           return 1;

       } else if (exponent == 1) {

           return base;

       } else {

           return (base * raiseToPower(base, exponent-1));

       }

   }

 

}

You might be interested in
Which file type is the best choice if the image will be made into a billboard?
matrenka [14]

Answer:

BMP

Explanation:

They are high resolution and are suitable for billboards.

6 0
2 years ago
How can i promote netiquette??​
Kay [80]

Answer: Neh - tuh - ket

Explanation:

The above answer is the phonetical pronunciation of the word Netiquette which is an amalgamation of the words, Net and Etiquette and as the term implies, refers to the behavior on the internet that is socially acceptable and good so that other people are not made to feel uncomfortable.

3 0
3 years ago
How is sharepoint used in organization today?
tatyana61 [14]
<span>To build a team site and collaborate with your colleagues</span>
8 0
3 years ago
Which text features does this section contain? Check all that apply.
NISA [10]

which ones apply manuelh


6 0
3 years ago
If a clean install is performed on a hard drive with a previous install of windows and the drive is not re-formatted during the
Tpy6a [65]
Either wiped off the drive, or right next to the new ones, I do not recommend keeping the old files.
3 0
3 years ago
Other questions:
  • A teacher uses the spreadsheet below to determine the average quiz score of each student. The teacher inserts this information i
    11·2 answers
  • Write a full class definition for a class named Averager, and containing the following members:______An data member named sum of
    6·2 answers
  • Tell me the shortcut keys used in Ms PowerPoint ?​
    6·2 answers
  • "what are the problems with tcp over wireless network?"
    15·1 answer
  • The voluntary linkage of computer networks around the world is called the ______.
    7·1 answer
  • Write a pseudocode that will take marks of physics, chemistry and math as input, calculates the average and displays output.
    7·2 answers
  • Write the definition of a function printDottedLine, which has no parameters and doesn't return anything. The function prints to
    10·1 answer
  • What decides the amount of delay between shots on a digital camera?
    7·1 answer
  • Draw a flow chart to access the marks of three students. calculate the total avarage and display the result​
    11·1 answer
  • Task 2
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!