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
For every decision you make, there is a trade-off. Please select the best answer from the choices provided T F
Dimas [21]
This is true, for every decision you make there is a trade-off.

7 0
3 years ago
Read 2 more answers
Suppose two hosts, A and B, are separated by 20,000 kilometers and are connected by a direct link of R = 2 Mbps. Suppose the pro
AnnZ [28]

Answer:

a. (210^6)((210^7)/(2.510^8)) = 1.610^5 bits or 160,000 bits

b. 1.6*10^5 bits or 160,000 bits

c. Bandwidth delay product of link is maximum number of bits that can be in the link

d. Width of bit = Length of link / bandwidth-delay product so 1 bit is 125 meters long. Yes, this is longer than a football field.

e. Width of bit = s/R

Hope this helps :)

3 0
3 years ago
In Super Mario 64, a character called Lakitu follows Mario around on a cloud, filming him with a camera as though he were shooti
ella [17]

Answer:

A second person prespective

Explanation:

6 0
3 years ago
Read 2 more answers
A software team is setting an automation strategy and begins by identifying business processes that could benefit from automatio
mixas84 [53]

B is what I would guess.

5 0
3 years ago
Name the types of computer used in hospital for computer​
disa [49]

Answer: These are all the computers they use All.

All In One Computers.

Medical Grade Computers.

Medical Tablets.

Medical Box PCs.

Medical Box PCs.

Displays & Monitors.

Medical Grade Monitors.

5 0
3 years ago
Other questions:
  • What was the purpose of the Declaration of Independence and what led to it​
    10·1 answer
  • Which of the following is *not* true about logging user and program actions on a computer?
    10·1 answer
  • Which of these are forms of data? Check all that apply.
    8·2 answers
  • 3.
    5·1 answer
  • In the list [0, 13, 5.4, "integer"], which element is at index 2?
    11·1 answer
  • What are the concerns surrounding 5G cellular networks?​
    6·1 answer
  • Discuss seven multimedia keys​
    8·1 answer
  • If, after fetching a value from memory, we discover that the system has returned only half of the bits that we expected; it is l
    8·1 answer
  • LIST THE BEST 10 3D PRINTERS WITH THEIR RESPECTIVE APPLICATION SOFTWARES.
    5·2 answers
  • If you want to create a line of code that will not appear in the interpreter, what symbol should begin the line?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!