Please help with coding assignment.

Java

Write a method where you have to generate random numbers between 1 to 9 until you get the number 5, and you do it j number of times. (j represents how many times you can generate.) If you do get to 5 under j number of times, you skip a line and end the method. Write the method stopAtFive.


public int stopAtFive (int j)

Answers

Answer 1

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.


Related Questions

Question 2: Did every packet arrive in the correct order? Describe what went wrong and whether your partner was able to read the message. If neither you nor your partner had an issue try sending another message.

Answers

Answer:

No, the packets did not arrive in the right order but the TCP protocol reordered the packets. The transmission took a while, but the message was finally delivered.

Explanation:

Packets are chunks of data from a data source or message transmitted from one computer device to another. Protocols like TCP or transmission control protocol and UDP (user datagram protocol) are used for data transfer, with TCP as the more reliable protocol (it checks for errors, retransmit lost packets, and reorders received packets in the destination device) and slow protocol.

Edhesive 8.7

Use the following initializer list:
w = ["Algorithm", "Logic", "Filter" "Software"
"Network", "Parameters" "Analyze", "Algorithm", "Functionality", "Viruses"]

Write a loop to print the words that start with "A"

Answers

w = ["Algorithm", "Logic", "Filter" "Software"

"Network", "Parameters", "Analyze", "Algorithm", "Functionality", "Viruses"]

for x in w:

   if x[0] == "A":

       print(x)

We check to see if a word begins with "A" and if it does, we print it to the console.

Can u write a python program with this output

Answers

Answer:

Not exact, but it will help.

Explanation:

do something like this.

       print("""

       this program will help you plan your garden.

       First, we need some information about the dimensions you want.

       """)

       while True:

           try:

               response = int(input("Please enter the side length for your garden (in feet) : "))

           except ValueError:

               print("(!)Please Enter A Number(!)")

               print("")

               continue

           if str(response) == "":

               continue

           else

               length = int(response)

               break

repeat stuff like that up above for the rest, and then you can decide what to do with the variables and how they need to be multiplied for the output. Good luck!

                       

what are spreadsheets in a excel workbook called? A. pages B. notepads C.graphs D.worksheets

Answers

D. Worksheets
I’m positive this is the correct answer

Which of the following describes all illustrations created by freehand?


extension lines

sketches

leader lines

dimensions

Answers

The answer is - Sketches

Rachel wants to copy eight rows of data from one spreadsheet to another. She opens the spreadsheet, highlights the appropriate data,
and selects the Copy command from the menu. What should she do next?

O Select the Cut command from the menu.

O Open the new spreadsheet.

O Double-click on the cells that are highlighted.

Select the Paste command from the menu,
Save and Exit

Answers

Answer:

Rachel should open the new spreadsheet first.  Then she can paste the cells she has copied.

Answer:

Explanation:

Rachel should open the new spreadsheet first.  Then she can paste the cells she has copied.

HELP PLEASE 50 POINTS

Answers

Answer:

do u know the muffin man

Explanation:

Answer:dk this old anyways

Explanation:tyftp

Question #6
ent
Fill in the Blank
You have defined your player data type.
class player:
life = 3
magic = False
name = "
You created an instance of your player data type and assigned values.
myPlayer = player()
myPlayer.life = myPlayer.life - 1
myPlayer.life = 4
myPlayer.magic = True
myPlayer.name = 'Kris'
What will be the value displayed after this line of code?
print(myPlayer.life)
You will see

Answers

Answer:

The answer is 4

Proof

A Document's Format is??

Answers

Answer:

A text or binary file format for storing documents on a storage media, especially for use by computers.

Explanation:

Answer:

The shape, size, design, and arrangement of its physical elements

Explanation:

Explain the difference between file and folder (in your own words)

Answers

Answer:

the difference is one is online and one is not

Explanation:

A file is usually what you find online. And a folder is what you put papers into.

does anyone like five finger death punch

Answers

Yes I do
Ejennsbdbdh

Answer:

I LOVE Five Finger Death Punch

my favorites from them are apologize, blue on black, and wrong side of heaven!

Explanation:

During a presentation, students are encouraged to show

enthusiasm because it is useful when a speaker is unsure of a topic.
nervousness because it leads to confidence and an engaging presentation.
nervousness because it helps the speaker relate to the audience.
enthusiasm because it leads to confidence and an engaging presentation.

Answers

Answer:

enthusiasm because it leads to confidence and an engaging presentation.

Explanation:

hope this helps :)

In any presentation, students are encouraged to show enthusiasm because it leads to confidence and an engaging presentation.

What is enthusiasm?

Enthusiasm is known to be a kind of human feelings that people often experience.

In the case of Enthusiasm, a person often experience their energy vibrating at the greatest  level.

Conclusively, In any presentation, students are encouraged to show enthusiasm because it leads to confidence and an engaging presentation and they can be excited and also happy as they make their presentation.

Learn more about presentation from

https://brainly.com/question/24653274

#SPJ2

What are the characteristics of a computer that make it different from other devices that hold electricity?

Answers

Answer:

Input, used to interact with, or send data to the computer (mouse, keyboards, etc.)

Output, which provides output to the user from the computer (monitors, printers, etc.)

Storage, which stores data processed by the computer (hard drives, flash drives, etc.)

Explanation:

Input, used to interact with, or send data to the computer (mouse, keyboards, etc.)

Output, which provides output to the user from the computer (monitors, printers, etc.)

Storage, which stores data processed by the computer (hard drives, flash drives, etc.)

Searching a database for a particular record requires an extension.
O True
O False

Answers

Answer:

False

Explanation:

I think it is right, I am not good with a lot of stuff

Answer:

Its True I got it right on ED

Explanation:

2.3 Code Practice: Question 1

Answers

Answer:

a=int(input("Enter a numerator: "))

b=int(input("Enter a divisor: "))

quotient=a/b

remainder=a%b

print("Quotient is: " + str(int(quotient)))

print("Remainder is: " + str(int(remainder)))

Explanation:

Hope this helps lovely :)

Answer:

Answer is in explanation

Explanation:

num = int(input("Enter Numerator "))

den = int(input("Enter Denominator "))

one=int(num/den)

two=int(num%den)

print(one + two)

full form of DMBM

plz.. give me answer.....​

Answers

Explanation:

database management system

nice to help .... but I think it is a computer ans

Please answer my question y'all!

Answers

Answer:

Explanation:1000 mp3s

Answer: It would be 50 MP3s

Explanation: 1000MB equals 1GB. 50 X 20 = 1000.

ALSO PLZZZ HELP :P Suppose you are purchasing a game at a local retail store that comes on DVD. In order to install it on your laptop, what must the laptop have?

A. a keyboard with a separate keypad for the arrow keys

B. an optical drive

C. an internet connection

D. an external monitor

Answers

I think the answer is B: an optical drive
Hope this helps have a great night

What happens if you create multiple accounts just to get points faster?

Answers

I don’t think it will work sadly. You can probably accumulate points though on your pre existing account. Hope that helps!

When you create multiple accounts just to get points faster, it does not help as the points will be to the individual account and as such it will not be faster but slower.

Can having multiple accounts quickly hurt your points?

If a person has a lot of  accounts, you have to know that it may have negative effect on your score.

Conclusively, Credit scores or point are not influenced by the number of bank accounts or other account that you have in your name and as such having a lot of account will not increase your points.

Learn more about  multiple accounts from

https://brainly.com/question/25787382

HELP PLSS‼️ Which are the following are considered peripherals? Mark all that are correct

Answers

Answer:

Speaker, Keyboard, Monitor, Mouse

Explanation:

A peripheral device is used to put input into (or receive output from) a computer. Parts of a computer wouldn't be considered peripheral.

if a network security professional wants to connect some computers in the same building without it using a router what type of network is being used

Answers

Answer:

 the MAC addresses of wireless NICs

Explanation:

Answer:

I would probably suggest Peer-to-Peer

Jane wrote a program that moves a mouse through a maze. But when the mouse took a right turn, it disappeared from
the maze. What kind of error should Jane fix to make the program run properly?
Oa Boolean error
O a logic error
O a syntax error
O an infinite loop error

Answers

Answer:

C. A Syntax error

Donna often travels around the world. When she travels, she needs to access her emails from different locations. However, to keep her luggage light, she does not carry her laptop. Which email program can Donna use?

Answers

Answer:

Yahoo! mail

Explanation:

In the context, Dona travels most often around the world. While traveling, she has to access her emails from different location and at different times. But in order to keep her luggage light, she never carries the laptop with her. Therefore, Donna uses Yahoo! mail to access her emails.

Donna uses Yahoo mail because she can install the Yahoo! mail app in her phone or tablets which is small in size and of light weight. She is able to organize her Outlooks,  Google mails and  Yahoo accounts. In Yahoo! mail, Donna is also able to sign in with her any of the non yahoo accounts and it also provides free cloud storage space.

Answer:

The answer is: B. Yahoo mail

Explanation:

Which is more compact?

- Binary
- ASCII decimal
- Hexadecimal
- BASE64

WHY?

Answers

Answer:

ASCII85 is the most efficient coding system – data size increases by just 20%. It has a couple of minor disadvantages. It uses a larger character set, and so it is only compatible with ASCII (unlike Base64, which supports various close relatives of ASCII). It is also slightly more demanding computationally, since it uses division rather than bit shifting. However, these factors are becoming increasingly irrelevant in the context of modern computer systems. The main reason that Base64 continues to be used more than ASCII85 is probably the simple fact that it has been around for longer.

Explanation:

A tornado destroyed many
CORRECT ANSWER GETS BRAINLIEST PLEASE HELP !
structures in a small Texas
town. Which type of engineer should be called in to collect
evidence in order to prevent this level of damage in the future?
A.chemical engineer
B.biomedical engineer
C.materials engineer
D.forensic engineer

Answers

Answer:

D is your answer because I'm an expert

Answer:

D. forensic engineer

Explanation:

Because I know the answer I got it right

PLZ HELP!! How does HTML help solve the problem of telling a computer what a web page looks like, not just the content that is on it?
Use complete sentences (at least 4).

Answers

HTML provides information to your browser about the organization of your document, including the locations of headers, paragraphs, and language that need emphasis.

What is HTML?

The preferred markup language for documents intended to be viewed in a web browser is HTML, or HyperText Markup Language.

Technologies like Cascading Style Sheets and scripting languages like JavaScript can help.

Your browser receives information from HTML about how your page is laid out, including the locations of headers, paragraphs, and material that needs to be highlighted.

Based on this knowledge, browsers have built-in default rules for how to display each of these elements. You are not obligated to select the default choices, though.

Thus, this way, HTML help solve the problem of telling a computer what a web page looks like.

For more details regarding HTML, visit:

https://brainly.com/question/15093505

#SPJ1

please help! ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎

Answers

I think the answer the the question is C

HURRY! PLEASE ANSWER! What additional lenses would be most beneficial to add to your collection and why?

Answers

Are you talking about camera lenses? If so every photographer should have the common focql lengths for prime lenses , a wide angle lense especially and a macro lense is great for magnification of subjects

network does not provide security to us​

Answers

Answer:

May this answer be helpful for you

Explanation:

1.False.

1.False. 2.Network security has many policies which ensure the secure surfing of the internet.

1.False. 2.Network security has many policies which ensure the secure surfing of the internet. 3.The policies do not allow unauthorized access. 4.Thus, network does provide security to us.

What is the result when you run the following line of code after a prompt??
>>>print(3 + 11)

Answers

Answer:

The following output is 14

Explanation:

When you print something, python interprets it and spits it out to the console. In this case, python is just interpreting 3 + 11, which equals 14. Thus, making the answer 14.

hope i helped :D

Answer:

14

Explanation:

Other Questions
What type of reader must a student be to understand how the facts in a text are being interpreted by different authors?an accurate readera factual readeran interpretive readera critical readerThanks! How many numbers have an absolute of 5/4 When it contracts, the difference in air pressure forces air into the body_____________ *celltissueorganorgan system Solve for p: 9(p-4)=-189(p4)=18 When a student shines a 540 nm laser through this grating, how many bright spots could be seen on a screen behind the grating? Charlie saves $29.85 each month for 6 months. In the seventh month, he only saves $10.20. How much money will Charlie have saved after 7 months PLEASE HELPWhat symbols does Frost use in "The Road Not Taken"? How do these symbols help shape the deeper meaning of the poem? Retell the "story" in light of the symbols. Write a paragraph of at least 125 words. change this into your own words. someone plsss helpp plsss Raquel bought a total of 18 roses and orchids. Roses were $2.50 each while orchids were $4.00 each. If she spent $54.00, how many of each did she purchase? Figure A is a scale image of figure B. Figure A maps to figure B with scale factor of 0.25. What is the value of x ? According to the passage why do changes need to be made to Nurtrition Facts labels ? Food serving Size Getting a Reallty Check Which of the following is TRUE about the polarity of water?(1 Point)only H atoms have electronselectrons are more strongly attracted to the H atomelectrons are more strongly attracted to the O atomelectrons are shared equally between all atoms within the molecule Every morning, Peter does the same 55-minute workout routine. He does a combination of jogging and floor exercises. The distance that Peter covers over time during his workout is shown in the graph below. Which statement is true of Peters morning workout routine?Peter jogs the same distance from points A to C and D to F.Peter stops jogging to do his floor exercises between points C and D.Peter jogs at a constant speed to reach the distance at point C from point A.Peter jogs for a longer period of time between points A and B than between points D and E. Find the value of the variable that results in congruent triangles for numbers 6 and 8. Sue and Kim earn $52 per week for delivering magazines. Sue worked for x weeks and earned an additional total bonus of $12. Kim worked for y weeks. Which expression shows the total money, in dollars, that Sue and Kim earned for delivering magazines? 64x + 52y 52x 12 + 52y 52x + 64y 52x + 12 + 52yQuestion 4(Multiple Choice Worth 1 points) Real estate values change over time. The value of current real estate can determine how much or how little you pay for a home or how much you sell it for.A. TrueB. False the concrete footings for piers for a raised foundation are cubes measuring 18 in. by 18 in. by 18 in. How many cubic yards are needed for 48 footings How do the parts of a cellenable it to survive? To get into the carnival, it costs $5. Then each ride costs $2.25. *Use a linear equation to solve the following:If you brought $35, how many rides can you go on?How much would it cost altogether to ride 7 rides? Reread lines 3045. Gold and diamond mining is an important part of South Africa's economy. In the past, most mine workers were African men who left their families in rural areas and worked under brutal conditions for white bosses. Why does Gordimer mentions her house's location above a mine here? Discuss how Gordimer's inclusion of the description of the miners is also an explanation of why people are afraid in South African society.