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
Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolut
STALIN [3.7K]

Solution :

x = float_(input())

y = float_(input())

z = float_(input())

res1 = x**z

res2 = x**(y**z)

res3 = abs(x-y)

res4 = (x**z)**0.5

print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(res1,res2,res3,res4))

Output is :

5.0

1.5

3.2

172.47 361.66 3.50 13.13

6 0
2 years ago
Does any of yall know how to delete your account?
il63 [147K]

Answer:

No i really don't but why would you want to delete your account

8 0
2 years ago
Two or more computers connected together is referred to as a(n)
son4ous [18]
Two or more computers connected together is referred to as a network.
So the answer is <span>B. network.</span>
8 0
3 years ago
Which view allows you to make changes to the content of your presentation?
Neporo4naja [7]

Answer:

Share your screen and edits the parts you want. What meet are you using, zoom or something else?

6 0
3 years ago
Write the pseudocode to this flowchart.
aleksandr82 [10.1K]

Answer:

I don't understand

Explanation:

4 0
2 years ago
Other questions:
  • Consider a set of mobile computing clients in a certain town who each
    13·1 answer
  • Which of the following are common problems experienced with software applications?
    15·1 answer
  • In order to plan George’s birthday, his father gave him a list of people who attended his birthday for the last five years. What
    8·2 answers
  • The inflationary gap occurs when you obtain no increase in output, but only an increase in the Average Price Level from an incre
    13·1 answer
  • What is DAP? How LDAP is different from DAP?
    10·1 answer
  • As a safe driver, you cannot, __________
    13·1 answer
  • Which of the following statements is true of a time management plan? It is work in progress that need to be altered many times?
    10·1 answer
  • Gina is upgrading your computer with a new processor. She installed the processor into your motherboard and adds the cooling sys
    9·2 answers
  • Select the correct word to complete the sentence.
    8·1 answer
  • Utilizando o padrão de medidas e unidades do National Institute of Standards and Technology, em que 1 KB é igual a 1.000 Bytes,
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!