Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assume we have defined a variable variable of type int called numSpaces with the following line of code: int numSpaces = ???; // numAsterisks can

Assume we have defined a variable variable of type int called numSpaces with the following line of code:

int numSpaces = ???; // numAsterisks can have any value

TASK: Print out two asterisks(i.e. the character '*'), with numSpaces empty spaces in between. In other words:

  1. Print a single asterisk
  2. Print an empty space exactly numSpaces times
  3. Print a single asterisk

EXAMPLE: If numSpaces is 5, you would print the following:

* *

NOTE: You do not need to create a class or a main method. We have done that behind the scenes.

Sample Input 1:

5

Sample Output 1:

* *

Sample Input 2:

8

Sample Output 2:

* *

PLEASE ANSWER IN JAVA

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

state what is meant by the term performance management

Answered: 1 week ago

Question

Evaluate three pros and three cons of e-prescribing

Answered: 1 week ago