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]
3 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]3 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
When making an assembly of design what command is most.commonly used?
Schach [20]
There are two common command lines used in creating design assembly. The 'push' and 'pull' command. Both allows you to get parts from the original predelivered content's source desgian    and recreate the design faster and with less memory.
6 0
3 years ago
When you create names for the elements of a webpage (such as ), what are some rules that you can follow to make your HTML code e
shusha [124]

Answer:

by using proper indentation

Explanation:

6 0
3 years ago
Read 2 more answers
Create a program in Matlab that prints the numbers from 1-100.
Burka [1]

Answer:

numbers = 1:1:100;

for num=numbers

remainder3 = rem(num,3);

remainder5 = rem(num,5);

 

if remainder3==0

disp("Yee")

else

if remainder3 == 0 && remainder5 == 0

disp ("Yee-Haw")

else

if remainder5==0

disp("Haw")

else

disp("Not a multiple of 5 or 4")

end

end

end  

end

Explanation:

  • Initialize the numbers variable from 1 to 100.
  • Loop through the all the numbers and find their remainders.
  • Check if a number is multiple of 5, 3 or both and display the message accordingly.
4 0
4 years ago
Please help me answer this question
Korolek [52]

Answer:

the arrow goes counter clockwise

Explanation:

In the battery symbol, the large line represents + and the smaller, thick line represents -. Since current flows from + to -, the direction is counter clockwise.

7 0
2 years ago
Consider a computer with two processes, H, with high priority, and L, with low priority. The scheduling rules are such that H is
marishachu [46]

Answer:

No

Explanation:

We know that Priority inversion can be seen as a scheduling situation in which higher priority task gets preempted by lower priority task. And that this is one of the main problem in priority scheduling.

If we overlook Priority scheduling and instead we decided to use Round Robin scheduling we will never encounter the priority inversion problem. As ,in Round Robin scheduling the process generally use a certain amount of time or time slices for each processes before it is force to wait for the next process.

3 0
3 years ago
Other questions:
  • HELP PLEASE
    7·2 answers
  • A(n) _________________________ is a character that word displays on the screen but is not visible on a printed document.
    13·1 answer
  • By Carl Sandburg
    6·1 answer
  • This needs to be written in Java.
    11·1 answer
  • The engineering firm you work for is submitting a proposal to create an amphitheater at a state park. Proposals must be submitte
    15·1 answer
  • Which is true of ASCII and Unicode?
    7·1 answer
  • Suppose that a 2M x 16 main memory is built using 256kB x 8 RAM chips and memory is word addressable, how many RAM chips are nec
    6·1 answer
  • List five application programs you recommend, and write a sentence explaining why.
    9·1 answer
  • You are a network administrator for your company. The network consists of a single Active Directory domain. All servers run Wind
    7·1 answer
  • Given an array of integers a, your task is to calculate the digits that occur the most number of times in the array. Return the
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!