For this exercise, you are going to write a recursive function that counts down to a Blastoff! Your recursive function will not actually print. It will return a String that can be printed from the main function. Each recursive call will add on to that string. In your main function, prompt the user for a starting value, then print the results. Sample Output Please enter a number to start: 5 5 4 3 2 1 Blastoff!     import java.util.Scanner; public class Countdown { public static void main(String[] args) { // Start here } public static String countdown(int number) { // Base case - return Blastoff! // Recursive call } }

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

For this exercise, you are going to write a recursive function that counts down to a Blastoff!

Your recursive function will not actually print. It will return a String that can be printed from the main function. Each recursive call will add on to that string.

In your main function, prompt the user for a starting value, then print the results.

Sample Output

Please enter a number to start: 5 5 4 3 2 1 Blastoff!

 

 

import java.util.Scanner;

public class Countdown
{
public static void main(String[] args)
{
// Start here

}

public static String countdown(int number)
{

// Base case - return Blastoff!

// Recursive call

}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Computational Systems
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning