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
NeX [460]
3 years ago
11

What is the best way to improve the following code fragment? if ((counter % 10) == 0) { System.out.println("Counter is divisible

by ten: " + counter); counter++; } else { System.out.println("Counter is not divisible by ten: " + counter); counter++; } Move the duplicated code outside of the if statement Shorten variable names Move the brackets to save several lines of code Add semicolons after the if condition and the else reserved word
Computers and Technology
1 answer:
meriva3 years ago
5 0

Answer:

Move the duplicated code outside of the if statement

You might be interested in
General equation: y = (89 / 27) - z * x + a / (a % 2) (recall: a is an integer; the 89 and 27 constants in the equation should b
liraira [26]

Answer: Here is an Incomplete question submitted

Explanation:

6 0
3 years ago
The Open Systems Interconnection (OSI) Reference Model: defines standards for many aspects of computing and communications withi
Advocard [28]

Answer:

is a generic description for how computers use multiple layers of protocol rules to communicate across a network.

Explanation:

OSI model stands for Open Systems Interconnection. The seven layers of OSI model architecture starts from the Hardware Layers (Layers in Hardware Systems) to Software Layers (Layers in Software Systems) and includes the following;

1. Physical Layer.

2. Data link Layer.

3. Network Layer.

4. Transport Layer.

5. Session Layer.

6. Presentation Layer.

7. Application Layer.

Hence, the Open Systems Interconnection (OSI) Reference Model is a generic description for how computers use multiple layers of protocol rules to communicate across a network.

Additionally, each layer has its unique functionality which is responsible for the proper functioning of the communication services.

8 0
3 years ago
What is the most efficient way to include a space after each paragraph
3241004551 [841]

To skip a line, then write the rest like this!


See? Good spacing, right?

4 0
3 years ago
) Perform error checking for the data point entries. If any of the following errors occurs, output the appropriate error message
emmainna [20.7K]

Answer:

In Python:

entry = input("Sentence: ")

while True:

   if entry.count(",") == 0:

       print("Error: No comma in string")

       entry = input("Sentence: ")

   elif entry.count(",") > 1:

       print("Error: Too many comma in input")

       entry = input("Sentence: ")

   else:

       ind = entry.index(',')+1

       if entry[ind].isnumeric() == False:

           print("Comma not followed by an integer")

           entry = input("Sentence: ")

       else:

           break

print("Valid Input")

Explanation:

This prompts the user for a sentence

entry = input("Sentence: ")

The following loop is repeated until the user enters a valid entry

while True:

This is executed if the number of commas is 0

<em>    if entry.count(",") == 0:</em>

<em>        print("Error: No comma in string")</em>

<em>        entry = input("Sentence: ")</em>

This is executed if the number of commas is more than 1

<em>    elif entry.count(",") > 1:</em>

<em>        print("Error: Too many comma in input")</em>

<em>        entry = input("Sentence: ")</em>

This is executed if the number of commas is 1

   else:

This calculates the next index after the comma

       ind = entry.index(',')+1

This checks if the character after the comma is a number

       if entry[ind].isnumeric() == False:

If it is not a number, the print statement is executed

<em>            print("Comma not followed by an integer")</em>

<em>            entry = input("Sentence: ")</em>

If otherwise, the loop is exited

<em>        else:</em>

<em>            break</em>

This prints valid input, when the user enters a valid string

print("Valid Input")

Note that: entry = input("Sentence: ") <em>is used to get input</em>

4 0
3 years ago
If your network consists of all connected devices connecting to one central device, such as a switch, what type of topology is b
3241004551 [841]

Answer:

The correct answer to the given question is " Star Topology ".

Explanation

In the star topology, all the devices are connected to one central device in the network. It means every individual device is connected individually with the central device in the network.

The main drawback of star topology is that if the central device fails then all the device which are connected with them is also failed. The second drawback of star topology is to connect with the central device it requires more cabling.

8 0
3 years ago
Other questions:
  • Linguist study
    9·1 answer
  • What is the slogan of the sociological school of criticism ?​
    9·1 answer
  • Why is the stateless nature of the internet a problem for shopping cart software? g?
    5·2 answers
  • Help!!!! ASAP TIMED TEST 50 points!!!!
    7·1 answer
  • Which is true about POP3 and IMAP for incoming email?
    13·1 answer
  • What is one reason the number of DUIs has dropped?
    7·1 answer
  • <img src="https://tex.z-dn.net/?f=%20%5Cfrac%7Bx%7D%7B1%20%2B%20x%7D%20%20%2B%20%20%5Cfrac%7Bx%20%2B%201%7D%7Bx%7D%20%20%3D%20%2
    15·2 answers
  • When looking at security standard and compliance, which three (3) are characteristics of best practices, baselines and framework
    8·1 answer
  • Why is the Microsoft website considered the best source for information about pagefile.sys?​
    15·1 answer
  • In a relational database, information is organized into tables in which each row represents a(n ) ________. Group of answer choi
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!