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
My name is Ann [436]
3 years ago
11

19. Squares. Write a program class named SquareDisplay that asks the user for a positive integer no greater than 15. The program

should then display a square on the screen using the character ‘X’. The number entered by the user will be the length of each side of the square. For example, if the user enters 5, the program should display the following: XXXXX XXXXX XXXXX XXXXX XXXXX INPUT and PROMPTS. The program prompts for an integer as follows: "Enter an integer in the range of 1-15: ". OUTPUT. The output should be a square of X characters as described above. CLASS NAMES. Your program class should be called SquareDisplay java
Computers and Technology
1 answer:
BaLLatris [955]3 years ago
4 0

Answer:

Explanation:

import java.util.Scanner;

public class SquareDisplay {

   public static void main(String []args){

    // Scanner is used to get value from command line

       Scanner console = new Scanner(System.in);

       System.out.print("Enter an integer in the range of 1-15:");

       int number = console.nextInt();

   // check if number is greater then 15 or less then 1 then return error message

       if(number>0 && number<=15){

           System.out.println("Error :Wrong Input");

           return;

       }

       for( int i=0; i< number; i++){

           for( int j =0; j<number; j++){

               System.out.print("X");

           }

           System.out.print(" ");

       }

   }

}

Code Explanation

As we want to show the square of X's we need to execute 2 nested for loop to achieve the target result. Outer for loop will determine that how many times we need to show the group of X's.

And the inner for loop will actually display's number of X's for every outer loop iteration.

Output

Case 1:

Enter an integer in the range of 1-15:5

XXXXX XXXXX XXXXX XXXXX XXXXX

Case 2:

Enter an integer in the range of 1-15:16

Error :Wrong Input

Case 3:

Enter an integer in the range of 1-15:2

XX XX

You might be interested in
Nick is moving from Alabama to Texas. A friend of his remarked that Nick may have to pay higher taxes there. What is the cheapes
Taya2010 [7]

Answer:

d is look up the Texas state website

Explanation:

because tell u about texas and taxes

3 0
3 years ago
What does the doppler effect do?
Alexeev081 [22]
The Doppler effect changes the sound frequency in a waveform relative to a moving object and its observer.<span />
4 0
3 years ago
Which statement best describes fonts from a serif font family?
Anuta_ua [19.1K]

Answer:

A

Explanation:

The main characteristic of a serif font is the tapered corners, so the answer would be A.

5 0
3 years ago
Which of the following describes evolution in the SDLC model?
stira [4]

Completing the requirements analysis is the evolutionary step of the Software development life cycle (SDLC). Hence option 3

<h3>What is the software development life cycle?</h3>

The SDLC is a method for evaluating and improving the development process. It enables a fine-grained study of each process phase. As a result, firms are able to maximize efficiency at each level.

SDLC aids in the achievement of these objectives by detecting inefficiencies and increased costs and resolving them so that everything runs smoothly.

Thus, Initial needs and architecture planning must be completed and are considered as an evolution in the SDLC model

Learn more about SDLC:

brainly.com/question/26366977

#SPJ1

4 0
2 years ago
What is a credit limit? athe required payment to your credit card company. bthe amount of interest you are charged each month. c
Gnom [1K]
I believe the correct answer from the choices listed above is option C. A credit limit is the maximum amount you can charge each billing cycle.  <span>The </span>credit limit<span> on your credit card is the maximum balance your credit card issuer allows. Hope this answers the question.</span>
4 0
4 years ago
Other questions:
  • List 5 major steps to make a bank deposit
    6·1 answer
  • A display that is thin, flexible, light, and easy to read in all types of light is
    9·2 answers
  • One reason for using social media is to develop social and professional contacts. True or False?
    9·1 answer
  • Technical colleges offer certification in audio engineering through programs that are normally from 2 to 6 months long. False Tr
    14·1 answer
  • Create an array using the makeRandomArray method, then take a start time using System.currentTimeMillis(). Next, run the array t
    13·1 answer
  • Final points give away
    13·2 answers
  • 7.4 code practice question 1 edhesive
    15·2 answers
  • If you want the input gear to spin in the same direction as the output gear you must use a _______ gear.
    13·1 answer
  • Name any five application or uses of smartphone and computer.<br>​
    8·1 answer
  • Need comments added to the following java code:
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!