subject

Write a program that randomly chooses among three different colors for displaying text on the screen. Use a loop to display 20 lines of text, each with a randomly chosen color. The probabilities for each color are to be as follows: white 30%, blue 10%, green 60%. Suggestion: Generate a random integer between 0 and 9. If the resulting integer falls in the range 0 to 2 (inclusive), choose white. If the integer equals to 3, choose blue. If the integer falls in the range 4 to 9 (inclusive), choose green. Test your program by running it ten times, each time observing whether the distribution of line colors appears to match the required probabilities.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 07:30
What part of the interface displays the external references contained in a selected cell? the status bar the review tab the scroll bar the formula bar
Answers: 1
question
Computers and Technology, 23.06.2019 22:20
If i uninstall nba 2k 19 from my ps4 will my career be gone forever?
Answers: 2
question
Computers and Technology, 23.06.2019 22:30
You draw two cards from a standard deck of 52 cards, but before you draw the second card, you put the first one back and reshuffle the deck. (a) are the outcomes on the two cards independent? why?
Answers: 3
question
Computers and Technology, 25.06.2019 08:50
98 points asap you have been asked to create a program for an online store that sells their items in bundles of five. select the appropriate code that would display how many bundles are available for sale. a.print(5 // totalitems) b.print(totalitems // 5) c.print(totalitems(5) ) d.print(5(totalitems) )
Answers: 2
You know the right answer?
Write a program that randomly chooses among three different colors for displaying text on the screen...
Questions
question
Mathematics, 20.04.2021 02:50
question
Mathematics, 20.04.2021 02:50
question
Computers and Technology, 20.04.2021 02:50