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
You are troubleshooting a mobile device that will not pair with a Bluetooth headset. The device was functioning properly with th
bulgar [2K]

Answer:

B. Replace the Bluetooth headset with a new pair.

Explanation:

Since all other mobile devices, after receiving the "corporate-wide" OS update, aren't having issues with pairing with Bluetooth headsets, we can safely conclude that the OS update isn't the issue.

To find out if the Bluetooth headset is not the culprit, we can try to pair the mobile device with a different headset. If it pairs correctly, then we can conclude that the old Bluetooth headset might have a fault, or it might need to be disconnected/forget from the device and paired gain.

7 0
3 years ago
A group of N stations share a 56-kbps pure ALOHA channel. Each station outputs a 1000-bit frame on average once every 100 sec, e
Sunny_sXe [5.5K]

Explanation:

Here, in the given statement, maximum flow capacity of the ALOHA channel = 18.4% = 0.184

Then, the stations N share 56 kbps

And, the channel rate = 0.184*56 = 10.304 kbps.  

Then, the outputs of the wach stations is 1000-bit frames/100 sec

\therefore, the output of the bits/ sec by each stations = \frac{1000}{100} bits/sec = 10 bits/sec

So, The output of the N stations is 10 bits/sec on the channel that having 10.304kb/sec

Finally, N = \frac{(10.304 \times 10^{3})}{10} = 1030 stations

3 0
3 years ago
What is the full form of w3c
Xelga [282]
The World Wide Web Consortium, which <span>is an international community where organizations, employees</span><span> and the general public work together to develop Web standards.</span>
7 0
3 years ago
The function below tries to create a list of integers by reading them from a file. The file is expected to have a single integer
Setler [38]

Answer:

Check the explanation

Explanation:

def get_list_of_integers_from_file(filename):

int_list=[]

for line in open(filename).readlines():

try:

int_list.append(int(line))

except:

continue

return int_list

print(get_list_of_integers_from_file('file.txt'))

 

File.txt:

Kindly check the output below.

4 0
3 years ago
A is a way for students to keep track of information during research
Ilya [14]
The choices are a) credible website B)search log c) Boolean operator d) online database.

The answer is, d. Online database. There are already numerous online digital tools that can aid research. Examples are readcube, mendeley, google scholar. It helps you save and organize researches as well as automatically give bibliographies according to your need like APA and MLA. These tools can hold and save different information that researchers need.
6 0
3 years ago
Other questions:
  • Fifty-three percent of U.S households have a personal computer. In a random sample of 250 households, what is the probability th
    11·1 answer
  • would specify that only selected members of the payroll and human resources department would have the right to change sensitive
    11·1 answer
  • You need to immediately terminate process id 2129. which command should you use?
    15·1 answer
  • Jenny is going on a trip to wildlife safari with her friends. She wants a camera that will help her shoot fast-moving animals. W
    15·2 answers
  • What does “int” means in php code
    13·1 answer
  • "what are the problems with tcp over wireless network?"
    15·1 answer
  • When we focus on stereotypes we may ___________________. a. experience culture shock b. develop ethnocentrism c. unconciously lo
    8·2 answers
  • Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "To
    9·1 answer
  • What is virtualization?
    11·2 answers
  • What is a device driver​
    13·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!