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
DaniilM [7]
3 years ago
15

1. Write an application that prompts the user to enter the size of the side of a square, and then displays a hollow square of th

at size made of asterisks. Your program should work for squares of all side lengths between 1 and 20. This is a sample run of your program: Enter·the·size·of·the·asterisk·square·from·1-20:3↵ ***↵ *·*↵ ***↵
Computers and Technology
1 answer:
belka [17]3 years ago
4 0

Answer:

import java.util.Scanner;

public class HollowSquare

{

public static void main(String args[])

{

Scanner scan = new Scanner(System.in);

int size;

System.out.print("Enter the size : ");

size = scan.nextInt();

if(size>=1 && size<=20)

{

for(int i=0; i<size; i++)

{

for(int j=0; j<size; j++)

{

if(i==0 || j==0 || i==size-1 || j==size-1)

System.out.print("*");

else

System.out.print(" ");

}

System.out.println();

}

}

else

System.out.println("Invalid size.");

}

}

You might be interested in
Assume the following variable definition appears in a program:
AnnZ [28]

Answer:

cout << setprecision(2)<< fixed << number;

Explanation:

The above statement returns 12.35 as output

Though, the statement can be split to multiple statements; but the question requires the use of a cout statement.

The statement starts by setting precision to 2 using setprecision(2)

This is immediately followed by the fixed manipulator;

The essence of the fixed manipulator is to ensure that the number returns 2 digits after the decimal point;

Using only setprecision(2) in the cout statement will on return the 2 digits (12) before the decimal point.

The fixed manipulator is then followed by the variable to be printed.

See code snippet below

<em>#include <iostream>  </em>

<em>#include <iomanip> </em>

<em>using namespace std;  </em>

<em>int main()  </em>

<em>{  </em>

<em> // Initializing the double value</em>

<em> double number = 12.3456;  </em>

<em> //Print  result</em>

<em> cout << setprecision(2)<< fixed << number;  </em>

<em> return 0;  </em>

<em>}  </em>

<em />

4 0
3 years ago
What is a distraction that you find when photographing animals at the zoo
yaroslaw [1]

D. All of the above.

<u>Reason:</u>

A. Fences can get in the way of a beautiful picture.

B: The animal's enclosure may be hard to get the perfect snap. Like a rock can be in the way of the animal. idk...lol

C. People want to see the animal as much as you do so they may block the way of a picture.

Example from Google..XD


7 0
3 years ago
Digital Subscriber Line (DSL) is a way for traditional telephone companies to provide Internet access a way for traditional cabl
zvonat [6]

Answer:

Option A is correct

Digital Subscriber line is a way where telephone companies provide internet access for connection.

It is a communication medium used to transfer digital signals. DSL is one of the most popular broadband internet access.

Explanation:

DSL stands for Digital Subscriber Line. DSL works with high-speed bandwidth that connects from a phone jack to a telephone network. DSL works within frequencies. You can use the DSL while making phone calls.

6 0
3 years ago
Read 2 more answers
An intruder can wreak havoc on a network by simply plugging in an infected USB flash drive.
Bas_tet [7]

Answer:

A. True

Explanation:

1. I took the test

2. Flash drive ports are connected to the rest of the computer, so putting in an infected flash drive into the port will cause the bug to spread throughout the whole device.

3 0
2 years ago
In a typical system design specification, the _____ section describes the constraints, or conditions, affecting a system, includ
Lapatulllka [165]

Answer:

The answer is "Option B".

Explanation:

The system environment includes all software external areas, which may vary from user to user. The System may be different, but it is part of the System environment, depending on the level of available memory. This environment is a part of the System development life cycle. and other options that are not correct which can be described as follows:

  • In option a, Time and cost estimates are part of the SDLC. It is a part where we calculate the overall cost and time for making any new software.
  • In option c, It is not a use in system environment it is reported.
  • In option d, System Components are a hardware device that by system environment for making a system environment but it does not include systems security that's why it is not correct.
6 0
3 years ago
Other questions:
  • Assume that the classes listed in the Java Quick Reference have been imported where appropriate.
    14·1 answer
  • Write an expression that evaluates to 1 more than the value in the location pointed to by the integer pointer variable ip. Thus,
    8·1 answer
  • A resistor bank is connected to a controller with conductor insulation rated 75 °C. The resistors are not used in conjunction wi
    15·1 answer
  • Budgets help you to do all of the following expect
    15·2 answers
  • What are computer virus ? Explain in detail.In your answer include symptoms and prevention (3each)
    10·1 answer
  • Employees at the Red Bluff Golf Club &amp; Pro Shop have the opportunity to become certified trainers if they log enough hours.
    13·1 answer
  • When specifying keywords to conduct an internet search, which of the following parts of speech will be the most useful??
    6·1 answer
  • How do you find specific words on a web page ...?? I know theres a shortcut for highlighting a specific word on a webpage on fir
    15·1 answer
  • What is word processors​
    8·1 answer
  • 72. In Object Oriented Programming, a class_____ starts
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!