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
zhuklara [117]
2 years ago
5

Write code to complete doublePennies()'s base case. Sample output for below program with inputs 1 and 10: Number of pennies afte

r 10 days: 1024 Note: If the submitted code has an infinite loop, the system will stop running the code after a few seconds, and report "Program end never reached." The system doesn't print the test case that caused the reported message.
Computers and Technology
1 answer:
UkoKoshka [18]2 years ago
8 0

Answer:

public class CalculatePennies {

// Returns number of pennies if pennies are doubled numDays times

  public static long doublePennies(long numPennies, int numDays) {

     long totalPennies = 0;

     /* Your solution goes here */

     if(numDays == 0){

         totalPennies = numPennies;

     }

     else {

        totalPennies = doublePennies((numPennies * 2), numDays - 1);

     }

     return totalPennies;

  }

// Program computes pennies if you have 1 penny today,

// 2 pennies after one day, 4 after two days, and so on

  public static void main (String [] args) {

     long startingPennies = 0;

     int userDays = 0;

     startingPennies = 1;

     userDays = 10;

     System.out.println("Number of pennies after " + userDays + " days: "

          + doublePennies(startingPennies, userDays));

     return;

  }

}

Explanation:

You might be interested in
Where is the Outlook Search Folder located?
melamori03 [73]
When you go to the mail go to file and click new it should be in there as search folder
6 0
3 years ago
How to prevent water pollution​
loris [4]

Answer:

Here is your answer

Explanation:

1. pick up litter and throw it away in a garbage can.

2. use environmentally household products such as washing powder, household cleaning agents

3. wash your car or outdoor equipment where it can flow to a gravel or grassed area instead of a street.

4. don't throw waste at ocean it will harm the animals and create tocsin.

6 0
2 years ago
g What differences do you anticipate there being between working inside vs outside City government in data and digital services?
Ivanshal [37]

Answer:

The work with city government is better than outside city government due to the reasons given below.

Explanation:

There are many differences while working in city government or outside city government. I choose city government job in data and digital service due to the following reasons.

  1. City government provides all types of facilities that are required in data management and digital services.
  2. Provision of more benefits along with salary from city government.
  3. City government arrange different training and development sessions for their employ.
  4. There are many learning and development opportunities, because they provide opportunity to work in different departments.  
  5. City Government have better HR policies as compared to outside government.
6 0
3 years ago
The best reason for using Independent software test teams is that
Kobotan [32]
The answer is B) A test team will test the software more thoroughly
4 0
3 years ago
Powerpoint increased the weight of a line in ____ increments.
USPshnik [31]
<span>One-fourth increments</span>
4 0
3 years ago
Other questions:
  • Which change signaled a musical progression toward rock and roll?
    14·1 answer
  • What is the assignment operator?
    15·1 answer
  • Scripting languages are distinguished by their ____ types.
    14·1 answer
  • As a bank employee, you often work from home and remotely access a file server on the bank’s network to correct errors in financ
    8·1 answer
  • PLZZZ HELP 30 POINTS!!
    14·1 answer
  • You want to create Web pages that can easily adapt to and serve multimedia content to smartphones, tablets, gaming devices and s
    13·1 answer
  • You are a network engineer tasked with performing a site survey for a multiple-channel architecture (MCA) system in a three-stor
    11·1 answer
  • What is an example of CT SO?
    9·1 answer
  • All of the Internet in your country disappears. What happens next?
    13·1 answer
  • How do you mark the brainiest?
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!