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
A computer screen that is contained in its own case and is not part of the computer system is called a
andre [41]

Answer:

Monitor is the correct answer

7 0
3 years ago
Read 2 more answers
Characteristics of successful entrepreneurs include
crimeas [40]
The answer would be A because grit means to fight hard to get what you want. Submission would be to give in to pressure and give up. Self-importance would be to only focus on yourself and no one else. A short attention span would not work out for you because you get distracted easily.
8 0
4 years ago
Give an example of how loops are used in programming Kturtle​
tankabanditka [31]

Answer:

Explanation:

KTurtle is an educational programming environment for turtle graphics. It is released under the open-source GNU General Public License and is part of the KDE Project since KDE3. KTurtle includes an IDE and a programming language which is loosely based on Logo and is intended for teaching programming.

5 0
3 years ago
A _______ file is a type of vector graphics file created specifically for Windows.
Tems11 [23]
A .wmf <span>file is a type of vector graphics file created specifically for Windows.</span>
7 0
4 years ago
Read 2 more answers
Sophia's plays her favorite game on her phone, where the game uses the phone's
nirvana33 [79]

Answer:

Augmented Reality

Explanation:

Augmented reality is a camera to overlay images on real-world scenery. Basically what the Pokemon GO app does.

8 0
1 year ago
Other questions:
  • Directions: pick the right letter for each number.
    11·2 answers
  • Joshua is creating his résumé, in which section will he add projects and trainings he was involved in?
    10·1 answer
  • Which of the following advertisements is most likely a legitimate job advertisement?
    14·2 answers
  • Linda is training to become a certified network design expert and consultant. While researching about the process of cellular ra
    12·1 answer
  • The emergence of MP3 (iPod) technology is an example of creative destruction because a. It is less expensive than compact discs
    14·1 answer
  • What problem is http solving?
    6·1 answer
  • A certain social media Web site allows users to post messages and to comment on other messages that have been posted. When a use
    7·1 answer
  • What is the relationship between an object and a class? A. An object is an instance of a class. B. A class is an instance of an
    5·1 answer
  • On a wireless network use _____ to ensure that only authorized client computers are able to access the wireless network.
    10·1 answer
  • If I bought mine craft p.e. for 7.99 and hook my Micro soft account up, will i get java edition
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!