Computers and Technology

Write code to complete doublepennies()'s base case. sample output for below program:

number of pennies after 10 days: 1024

note: these activities may test code with different test values. this activity will perform three tests, with startingpennies = 1 and userdays = 10, then with startingpennies = 1 and userdays = 40, then with startingpennies = 1 and userdays = 1. see how to use zybooks.

also 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.

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 */

else {
totalpennies = doublepennies((numpennies * 2), numdays - 1);
}
return totalpennies;
}

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:00, nika0001
When designing content as part of your content marketing strategy, what does the "think" stage represent in the "see, think, do, care" framework?
Answers: 3
image
Computers and Technology, 22.06.2019 17:30, uh8hardiek
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
image
Computers and Technology, 23.06.2019 06:30, Knownothing
When early motion pictures played in movie theaters, they were often accompanied by live organ or piano music. which of the following are the most likely reasons that this happened? (select all that apply). the music was provided to distract audience members from the loud sounds made when filmstrips were changed. the music accompanied the movies because the movies were silent and audiences were used to hearing music during plays in theaters. the music usually was played before, and sometimes after the movie, as an alternative form of entertainment. the music viewers to interpret the dramatic action in the films.
Answers: 2
image
Computers and Technology, 23.06.2019 22:00, bb1593
Jackson, who works in the finance department of a company, is holding a seminar for other employees on how to file taxes. only three employees sign up to attend the seminar. which device can he use to share his presentation with a group of three employees?
Answers: 1
Do you know the correct answer?
Write code to complete doublepennies()'s base case. sample output for below program:

nu...

Questions in other subjects:

Konu
History, 06.11.2020 22:10
Konu
Mathematics, 06.11.2020 22:10