Challenge (6/12/2020)

We post one challenging problem here every week. Solution due is 11:59 PM every Friday. We offer awards to two responders. 1. The first one with the right solution. 2. The correct solution with fewest code statements.

If we get only one correct solution, we will skip the award for the fewest code statements.

You need to create an account in this club in order to participate in this competition. The solution can use one of these three languages: Java, Python, JavaScript. You can submit your solution to this topic. Make sure your name and email account are in the end of the solution.

If you want that we indent your code correctly, please submit your code to this challenge along with a screenshot of your code in your IDE or your code file as an attachment. Remember you still need to submit your code as text here. Thanks for your participation.

Problem: When you choose the programming language, find out the way to output text in color in console. Write an application that can take three user input for RGB value respectively. The input must be an integer between 0 and 255 inclusive. If the user input is invalid, you need to warn the user and then ask for the input again. Your application will keep asking for valid input until you get three valid values. Once you get the valid input, find the minimum value of the three. Then loop through from 0 to that value, say Red (inclusive). Decide the interval for the other two values, say green and blue so when you loop through from 0 to the minimum, these two values can also increase from 0 to those (green and blue) values in their own interval. In each interation, output the valid input value in color (RGB) using the values you get in each iteration. For example, the input is 24, 100 and 80. Then I loop from 0 to 24 for red. In each iteration, red value will be 0, 1, 2, 3 … Then green value will be 0, 100/24, 2*100/24… Blue value will be 0, 80/24, 2*80/24… Use these RGB values to create a color and print out 24, 100 an 80 in that color. Make sure your color RGB value is integer in each iteration.

3 thoughts on “Challenge (6/12/2020)”

Leave a Reply