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]
3 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]3 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
List three tacos there are several from the opening page of the help and support center.
s344n2d4d5 [400]
Mexican tacos sascSDV
8 0
4 years ago
Claire is a manager at an information technology (IT) firm. She notices a consistent drop in the productivity of her employees.
Karolina [17]
D identifying decision criteria
3 0
3 years ago
To make slides in a powerpoint online application presentation have the same transition effect, select __________ on the transit
Artemon [7]

Answer: Animations

Explanation:

Transitions, such as fade, can be applied to all using the command Ctrl+A.

Transitions are found under the animations Tab. Sorry about the bots.

Hope This Helped!

8 0
2 years ago
Please answer this correctly what’s the answer opening modify style dialog box enables you to
Aloiza [94]
The answer is all of the above
4 0
4 years ago
The device used to control a heating system in the home is called a thermostat.
Makovka662 [10]
<span>The device used to control a heating system in the home is called a thermostat.
This is a true statement.
</span>
3 0
4 years ago
Other questions:
  • A __________ network is good for connecting computer clusters.
    13·2 answers
  • Dr. Laos gets a referral for a 6 month old who has become listless and stopped eating lately. Her pediatrician wanted her to be
    15·1 answer
  • Describe how the Internet Protocol (IP) allows devices to easily connect and communicate on the Internet.
    12·2 answers
  • Hard drives have the largest capacity of any storage device. <br> a. True <br> b. False
    6·2 answers
  • (1) Prompt the user to enter a string of their choosing. Output the string.
    11·1 answer
  • Identify the characteristics of logic problems.select all that apply
    5·1 answer
  • You are a cleared employee. Your friend called and told you that he saw information about the classified XYZ program on the Inte
    10·1 answer
  • How does design influence the product's function?
    5·1 answer
  • write an algorithm and draw a flowchart to calculate the sum of of the first 10 natural numbers starting from 1​
    13·1 answer
  • Why are women more exposed to mass media?
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!