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
il63 [147K]
4 years ago
6

Write a method called makeStars. The method receives an int parameter that is guaranteed not to be negative. The method returns

a String whose length equals the parameter and contains no characters other than asterisks. Thus, makeStars(8) will return ******** (8 asterisks). The method must not use a loop of any kind (for, while, do-while) nor use any String methods other than concatenation. Instead, it gets the job done by examining its parameter, and if zero returns an empty string otherwise returns the concatenation of an asterisk with the string returned by an appropriately formulated recursive call to itself.
Computers and Technology
1 answer:
serious [3.7K]4 years ago
6 0

Answer:

// import the Scanner class

// to allow the program receive user input

import java.util.Scanner;

// The class Solution is defined

public class Solution{

   // main method to begin program execution

   public static void main(String[] args) {

       // scanner object scan is declared

       Scanner scan = new Scanner(System.in);

       // Prompt the user to enter a number

       System.out.println("Enter the number of stars you want: ");

       // user input is assigned to numOfStar

       int numOfStar = scan.nextInt();

       // call the makeStars method

       makeStars(numOfStar);

   }

   

   // makeStars method print stars using recursion

   // the method call itself till starNum == 0

   public static void makeStars(int starNum){

       if (starNum != 0){

           System.out.print("*");

           makeStars(starNum -1);

       }

   }

}

Explanation:

The code is well comment and solve the problem using recursion.

You might be interested in
You can undo up to the most recent 40 actions by clicking the undo button.
Cloud [144]
The answer is true. The Undo command is set up on the toolbar.  You can undo up to 40 edits in your plan by clicking on the Undo button.  If you want to undo all of the revises made, simply quit (close your Internet browser window or start a new plan) without saving. 
6 0
3 years ago
If you were driving the blue Prius in the situation pictured above, explain why the red Mustang should be given right-of-way at
raketka [301]

Answer:

The red Mustang should be given the right-of-way at this intersection because:

The red Mustang arrived first before the blue Prius and is closer to the stop sign before the arrival of the blue Prius.  This implies that the red Mustang must have waited for its turn, unlike the blue Prius that just arrived at the intersection.

Explanation:

Traffic laws, regulations, and IPDE defensive driving strategy require that drivers always give way to the vehicle that arrived before them at an intersection.   Assuming that multiple vehicles reach the intersection simultaneously, then the vehicle must be given the right-of-way.  Alternatively, the traffic lights at the intersection should be obeyed and be allowed to regulate the movement of vehicles.  IPDE defensive driving strategy requires drivers to be watchful of their driving spaces to determine the appropriate time to move.

8 0
3 years ago
The term BIOS stands for
iren2701 [21]
Basic Input-Output System
8 0
3 years ago
Which function converts the user's input to a number with a decimal?
levacccp [35]

Answer:

Explanation: integer is the meaning of int() if you payed attention to programming class, int() would be a WHOLE number and not a decimal number, 2nd of all, a decimal number would be float() so the answer is int() hope i helped!

Explanation:

hope this helped good luck

4 0
3 years ago
What is the first computer was brought in nepal and for what purpose​
german

Answer:

The first computer bought in Nepal was IBM 1401 which was brought by the goverment in lease for the populations census of 1972.

7 0
3 years ago
Read 2 more answers
Other questions:
  • Select the correct answer.
    8·2 answers
  • Suppose you define a java class as follows: public class test { } in order to compile this program, the source code should be st
    14·1 answer
  • What portable computing devices, designed for user convenience, have a sensor called an accelerometer that senses vibrations and
    10·1 answer
  • A microphone is a type of electronic.<br><br> True/Faulse
    14·1 answer
  • 5. Drawing Conclusions If you were a person in
    10·1 answer
  • Machinery with rotating or reciprocating parts that are within seven feet of the floor or working platform requires what additio
    7·1 answer
  • Histogram 9AMAA 12/01/2021.
    9·1 answer
  • What solicits online input such as product ratings from consumers?
    7·1 answer
  • How can you apply multimedia for study explain​
    11·1 answer
  • Do you need a separate password for each slack channel
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!