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
elena-14-01-66 [18.8K]
3 years ago
11

Please help with coding assignment.

Computers and Technology
1 answer:
Inessa05 [86]3 years ago
4 0

Answer:

import java.util.Random;

class Main {

   

   public int stopAtFive (int j) {

      Random rand = new Random();

      int number = 0;

      for(int i=0; i<j; i++) {

          number = rand.nextInt(9)+1;

          System.out.println(number);

          if (number == 5) {

              System.out.println();

              break;

          }

      }

      return number;

   }

   

   public static void main(String args[]) {

       Main main = new Main();

       main.stopAtFive(20);

       main.stopAtFive(20);

   }

}

Explanation:

Your requirements do not say what has to be displayed or returned from the method, but you can use this as a starting point.

You might be interested in
A restaurant is a workplace for someone whose career specialty is in
Rashid [163]
A restaurant is a workplace for someone whos career specialty is in... Cooking

The answer is: Cooking
3 0
3 years ago
Read 2 more answers
__________ are very simple devices that connect network components, sending a packet of data to all other connected devices.
taurus [48]

Hubs are very simple devices that connect network components, sending a packet of data to all other connected devices.

Hubs are relatively basic network connectors that send a packet of data to every other connected device. Compared to a hub, a switch is more intelligent and has the ability to filter and forward data to a specific location. Within various networks, switches are utilized. Nodes of the network are any computers or printers connected to it. A network workstation is a personal computer that is linked to a network (note that this is different form the usage of the term workstation as a high-end microcomputer). Nodes of the network are any computers or printers connected to it. A network workstation is a personal computer that is linked to a network.

Learn more about network here-

brainly.com/question/24279473

#SPJ4

8 0
10 months ago
The protocol that enables computers on the Internet to communicate with each other is called _____.
dybincka [34]
"C" is the correct answer, if its correct please mark me brainliest.
5 0
3 years ago
A palindrome is a string that reads the same from left to right and from right to left. Design an algorithm to find the minimum
stepladder [879]

Answer:

Explanation:

The following code is written in Python. It is a recursive function that tests the first and last character of the word and keeps checking to see if each change would create the palindrome. Finally, printing out the minimum number needed to create the palindrome.

import sys

def numOfSwitches(word, start, end):

   if (start > end):

       return sys.maxsize

   if (start == end):

       return 0

   if (start == end - 1):

       if (word[start] == word[end]):

           return 0

       else:

           return 1

   if (word[start] == word[end]):

       return numOfSwitches(word, start + 1, end - 1)

   else:

       return (min(numOfSwitches(word, start, end - 1),

                   numOfSwitches(word, start + 1, end)) + 1)

word = input("Enter a Word: ")

start = 0

end = len(word)-1

print("Number of switches required for palindrome: " + str(numOfSwitches(word, start, end)))

3 0
2 years ago
This operator represents the logical AND.
sdas [7]

Answer:

C. &&

Explanation:

Of the options provided:

A) ++ : increment operator. For example : ++1 = 2

B) || : Logical OR operator. A || B is true if any one of A or B is true.

C) && : Logical AND operator. A && B is true if both A and B are true.

A            B         A && B

False    False      False

False    True       False

True     False      False

True     True        True

D) @ : Ampersand character (commonly used in email addresses) e.g, [email protected]

3 0
2 years ago
Other questions:
  • In Linux Operating System, what file extension is used forexecutable files?
    6·1 answer
  • )1-bit sign, 8-bit exponent, 23-bit fraction and a bias of127 is used for ___________ Binary Floating PointRepresentation
    11·1 answer
  • Look at the slide. How could the slide best be improved? By reducing the number of visual aids by increasing the font size by da
    8·2 answers
  • Identify the four basic categories of hardware in a microcomputer system. system unit, modem, ram, and microprocessor system uni
    5·1 answer
  • The term ________ refers to fluid flow back to the pan to empty or drain a circuit.
    5·1 answer
  • When adding cells you must use a "+" symbol, you cannot use a ":" symbol.<br><br> ☐ True<br> ☐ False
    13·1 answer
  • A rocket always rotates about its___?
    9·2 answers
  • Where is the BIOS stored?<br><br> CPU<br> CMOS<br> RAM<br> Northbridge
    13·2 answers
  • Which factor is NOT used to determine who can be let go during a downsizing?
    8·2 answers
  • What is intellectual property rights law ?​
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!