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
tino4ka555 [31]
3 years ago
9

3. Write a method squareOfAsterisks that displays a solid square (the same number of rows and columns) of asterisks whose side i

s specified in integer parameter side. For example, if side is 4, the method should display **** **** **** **** Incorporate this method into an application that reads an integer value for side from the user and outputs the asterisks with the squareOfAsterisks method.
Computers and Technology
1 answer:
iren2701 [21]3 years ago
8 0

Answer:

Following are the program to this question:

#include <iostream>//defining header file

using namespace std;

void squareOfAsterisks(int x) //defining method squareOfAsterisks

{

   int i,j; //defining integer variable

   for(i=1;i<=x;i++) //defining loop to print column value

   {

   for(j=1;j<=x;j++) //defining loop to print row value

   {

   cout<<"*"; //print value

   }

   cout<<endl; //for line break

   }

}

int main() //defining main method

{

int x; //defining integer variable

cout<<"Enter any number: "; //print message

cin>>x; //input value from user

squareOfAsterisks(x); //calling the method and pass the value

return 0;

}

Output:

Enter any number: 4

****

****

****

****

Explanation:

The description of the above program can be given as follows:

  • In the given program a method "squareOfAsterisks" is declared, that accepts an integer value "x" in its arguments, inside the method two integer variable I, j is used, that uses a to print the given pattern.
  • In the main method, an integer variable x is declared, which takes input from the user end, and then calls the method, that is "squareOfAsterisks" and passes its value.
You might be interested in
4. Give name=
Svet_ta [14]

Answer:

What does Bob [1] return?

What about Bob[-2]?

What about Bob[1:-1]?

How to get the length of Bob?​

Explanation:

8 0
3 years ago
LISTEN I NEED EVERY SINGLE BRAINLY USER TO RE POST THIS THERE IS A USER WHO JUST SAID THEY ARE GOING TO KILL THEMSELVES PLEASE C
Over [174]
WHAT IS THE NAME OF THE BRAINLY USER
7 0
3 years ago
Read 2 more answers
Given a one-dimensional array named yearlySalesTotals that contains decimal values, code the first line of a for statement that
VashaNatasha [74]

Answer:

for(int i =0; i<yearlySalesTotals.length;i++)

Explanation:

The for statement in has the syntax as given above, it has an int variable indicating the starting index, then a boolen condition ensuring that you don't get out of the array bounds, and an increment operator.

See below a complete program in java that will output all elements of the array  assuming the array yearlySalesTotals contains only ten elements and all indexes has been assigned values.

public class ANot {

   public static void main(String[] args) {

double []yearlySalesTotals = new double[10];

for(int i = 0; i<yearlySalesTotals.length; i++){

   System.out.println(yearlySalesTotals[i]);

   }

}

}

7 0
3 years ago
Jnhj hjibfnufnbfjbnkfv fj v
kirill [66]

Answer: baller.

Explanation:

6 0
3 years ago
Most internet connections use what transmission
Orlov [11]
Most internet connections use full-duplex transmissions. (Please give brainliest answer :) :D )
7 0
3 years ago
Read 2 more answers
Other questions:
  • Jamie is not sure a new medication will work because it has not had a large test group. Is Jamie being creative?
    9·2 answers
  • Which device can be installed on the edge of your network to allow multiple remote users to connect securely to your internal en
    9·1 answer
  • Why would a user want to compress a large file before sending it as an email attachment?
    13·2 answers
  • With _______, applications are owned, delivered and managed remotely by one or more providers over the Internet or an intranet,
    15·1 answer
  • Well this isn't school related, but how do i watch dubbed and subbed anime for free on my computer?
    7·2 answers
  • When is it not necessary to invoke the method myMethod using dot notation? When myMethod is private. When myMethod is invoked by
    14·2 answers
  • Given an array arr, of type int, along with two int variables i and j, write some code that swaps the values of arr[i] and arr[j
    11·1 answer
  • Digital communication and production chapter 17
    6·1 answer
  • ______________________ can run on a workstation or server and is at the heart of all business applications.
    7·1 answer
  • What will be the output, if any, when the user clicks the right mouse button?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!