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 15:30
The song about casey jones a railroad engineer who gives his life on the job would most likely gall under the folk song category of? a-work song b-nonsense song c-religious song d-ballad
Answers: 1
question
Computers and Technology, 23.06.2019 16:30
20 points archie wants to use a reflector as he photographs a newlywed couple. what would he consider in his choice? a. shadow and sunny b. homemade and professional c. lamps and boards d. incident and reflected e. neutral density and enhancement
Answers: 3
question
Computers and Technology, 23.06.2019 17:30
Write pseudocode to represent the logic of a program that allows the user to enter a value. the program multiplies the value by 10 and outputs the result.
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
It is not necessary to develop strategies to separate good information and bad information on the internet. true or false
Answers: 1
You know the right answer?
Write a program that randomly chooses among three different colors for displaying text on the screen...
Questions
question
Mathematics, 28.07.2019 20:20
Questions on the website: 13722360