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
natta225 [31]
4 years ago
12

Write a method starString that accepts an integer parameter n and returns a string of stars (asterisks) 2n long (i.e., 2 to the

nth power).
Computers and Technology
1 answer:
lys-0071 [83]4 years ago
4 0

Answer:

public class Main

{

public static void main(String[] args) {

 System.out.println(starString(4));

}

public static String starString(int n){

    double p = Math.pow(2,n);

    String s = "";

    for(int i=0; i<p; i++)

        s += "*";

       

   return s;

}

}

Explanation:

Create a method named starString that takes an integer parameter, n

Get the 2 to the nth power using pow method and set it to the p

Create an empty string that will hold the asterisks

Create a for loop that will iterate p times. Inside the loop, concatenate an asterisk to the s

Return the s

Inside the main method, call the method with an integer parameter

You might be interested in
What's a pfp? I keep seeing it on scratch
HACTEHA [7]
A pfp is a Profile-Picture can I pls have brainliest
3 0
3 years ago
Read 2 more answers
Write a program that, given an integer, sums all the numbers from 1 through that integer (both inclusive). Do not include in you
fgiga [73]

Answer:

let n = 10;

let sum = 0;

for(i=1; i<=n; i++) {

if ((i%5) && (i%7)) {

 sum += i;

}

}

console.log(`Sum 1..${n} excluding 5 and 7 multiples is ${sum}`);

Explanation:

This is in javascript.

example output:

Sum 1..10 excluding 5 and 7 multiples is 33

5 0
3 years ago
Richard wants to create a cloud-based system that will be a centralized repository of log files from various servers in the orga
jeyben [28]

Answer:

CAD ( d )

Explanation:

Richard should use CAD to create a cloud-based system, since he wants it to be a centralized repository of log files to be taken from the different servers associated with the organization

CAD ; Computer aided design software is the best software to be used because files created using CAD can be easily stored in cloud and it is easily accessible.

4 0
3 years ago
Write a program that displays the smallest of five input values that may include duplicate values (e.g., 6, 4, 8, 6, 7). Hint: R
Tpy6a [65]

Answer:

Here the code is given as follows,

Explanation:

Code:-

import java.util.*;

class Chegg {

 

   public static void main(String args[])

   {

       Scanner sc=new Scanner(System.in);

       System.out.println("Enter 5 numbers");

       int arr[]=new int[5];

       int min;

       for(int i=0;i<5;i++)

       {

           arr[i]=sc.nextInt();

       

       }

       min=arr[0];

       for(int i=1;i<5;i++)

       {

           if(arr[i]<min)

           {

               min=arr[i];

           }

       }

       System.out.println(min);

   }

}

3 0
3 years ago
major, large city newspaper endorsements often carry important weight, especially in down ballot races for local offices.
Lunna [17]

True- major, large city newspaper endorsements often carry important weight, especially in down ballot races for local offices.

<h3>What is endorsement?</h3>

Endorsements are a type of advertising that makes use of well-known figures or celebrities that enjoy a high level of public awareness, respect, and/or recognition. These persons serve as brand ambassadors by using their names or likenesses to advertise a good or service. An endorsement, in a broader sense, is an expression of agreement with or support for something or someone; the endorser may or may not get payment. A blank endorsement is one on which the endorser merely signs his name and the bearer is the recipient. Special Endorsement: This is where the endorser signs and specifies who will get the cash. Endorsement with Restrictions: This prevents further discussion.

To know more about endorsement visit:

brainly.com/question/29734234

#SPJ1

3 0
1 year ago
Other questions:
  • \Read the sentence.
    12·1 answer
  • When backing up a database server to LTO tape drives, the following schedule is used. Backups take one hour to complete.
    12·1 answer
  • Adding functionality to a Button is easy when you use the IDE. After you have dragged a Button onto a Form, you can ____ it to c
    7·1 answer
  • How do you make a 'does not equal' symbol on the computer? you know the equal sign with a line through it..?
    6·1 answer
  • What are the best ways to find data within a spreadsheet or database? Check all that apply. sorting tools the help function scro
    11·2 answers
  • A TCP segment consisting of 1500 bits of data and 160 bits of header is sent to the IP layer, which appends another 160 bits of
    12·1 answer
  • The first step in transforming an extended e-r model into a relational database design is to
    14·1 answer
  • How do i get around a school related block
    13·2 answers
  • To generate a series of first ten counting number of algorithm​
    9·1 answer
  • what are some steps Hector could have taken to ensure that his photographs were not ruined near the end of the shoot?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!