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
Select the correct answer.
VARVARA [1.3K]

Answer:

D

Explanation:

It is D

Select the correct answer.

Identify the correct CSS syntax to link an external style sheet.

6 0
2 years ago
Which of the following types of tasks are comparatively easy for artificial intelligent systems?
Varvara68 [4.7K]

Answer:

I believe the answer would be B) Expert tasks?

Explanation:

Might be wrong but trust your gut!!

I believe this because.. wasn't that what most AI was made for/programmed to do....??  Carry out tasks that others couldn't do so easily? Ask yourself............

Have a wonderful weekend and good luck!!!

5 0
2 years ago
Jack and Diane are creating each ClassID following this pattern: first two letters of ClassName (one uppercase, one lowercase),
Norma-Jean [14]

Answer:

i dont know 123 IdK

Explanation:

6 0
4 years ago
Why is it important to create a web maintenance schedule? Check all of the boxes that apply.
Andreas93 [3]
Attach a picture so we can see the question
3 0
3 years ago
55 POINTS, IN JAVA
ikadub [295]

public class JavaApplication82 {

   

   public static void main(String[] args) {

       

       for (int i = 1; i <= 9; i++){

           for (int w = 0; w < i; w++){

               System.out.print("*");

           }

           System.out.println("");

           

       }

   }

   

}

This works for me.

6 0
3 years ago
Other questions:
  • For local travel addresses and street names should be
    14·1 answer
  • Instructions:Select the correct answer.
    8·1 answer
  • What are some examples for Environmental Technology?
    5·2 answers
  • What are the four requirements of a linear programming​ problem?
    8·1 answer
  • Malcolm is part of a team developing a new smartphone app to track traffic patterns. Because team members are located throughout
    12·1 answer
  • Which wireless standard has bandwidth up to 54 Mbps and signals in a regulated frequency spectrum around 5 GHz?
    13·1 answer
  • Write a method drivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar co
    12·1 answer
  • Sensory cues are used for script writers to be able to get more creative with the story their are scripting for (i.e.
    15·1 answer
  • Alfred works in the human resources department, and he uses a management information system to find applicants' résumés on the w
    7·1 answer
  • How to look at things you previously applied to on handshake
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!