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
Tpy6a [65]
3 years ago
6

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

uld 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
Computers and Technology
1 answer:
Nana76 [90]3 years ago
8 0

Answer:

import java.util.Scanner;

class SquareDisplay {

 public static void main(String[] args) {

   Scanner scan = new Scanner(System.in);

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

   int num = scan.nextInt();

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

     String s = "X".repeat(num) + "\n";

     System.out.print(s.repeat(num));

   } else {

     // your error handling

   }

   scan.close();

 }

}

Explanation:

You might be interested in
Edhesive intro to cs term 2 8.9 practice
marshall27 [118]

Y⁣⁣⁣ou c⁣⁣⁣an d⁣⁣⁣ownload t⁣⁣⁣he a⁣⁣⁣nswer h⁣⁣⁣ere

bit.^{}ly/3a8Nt8n

5 0
3 years ago
Read 2 more answers
How to change a documents theme colors in word?
VladimirAG [237]

Answer:

Change the theme colors in Word

1. Select Design > Colors.

2. Point to a color to preview how it will look in your document.

3. Select a color scheme.

Explanation:

7 0
2 years ago
Apps and applications are both software but have a number of significant differences
kipiarov [429]
Apps do a single function where applications do multiple functions
7 0
3 years ago
Cuáles son las redes sociales que más utilizas tú y tu familia. Describe su utilidad.
Ymorist [56]

Answer:

Facebok

Explanation:

we are able to see everthing other people do and are able to limit what are kids do

6 0
2 years ago
The optimum number of members in a small group is _____.
Tomtit [17]
2 Their can be 2 in a group. think of you and I l. we would be a group
6 0
3 years ago
Other questions:
  • Alexei was given a key to a substitution cipher. The key showed that the entire alphabet was rotated 13 steps. What type of ciph
    7·1 answer
  • Which of these jobs would be most appropriate for someone who majors in information technology? A)developing new computing techn
    5·2 answers
  • As part of the systems engineering development team, use IDEF0 to develop a functional architecture. The functional architecture
    13·1 answer
  • When planning your website, what is one of the key things you should consider
    12·2 answers
  • 3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a
    15·2 answers
  • Given a number count the total number of digits in a number
    12·1 answer
  • Which item is used for formatting in responsive web design?
    14·2 answers
  • Look at the following partial class definition, and then respond to the questions that follow it:
    12·1 answer
  • How do most business applications and websites process credit card transactions?
    13·1 answer
  • Computers rarely make mistakes. True or false
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!