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.
https://docs.google.com/document/d/1PPkP35r4Ttu9KFIsQkFRYgVm25P38JVD5YeaNA59Iag/edit?usp=sharing
https://docs.google.com/document/d/1JB54VNGpRoKj3axn4x9iIvp9qyMV1LK428RWFcYb47Y/edit?usp=sharing
We do not have a winner this week. The error from both answers are posted here along with the right answer (code modified from danielchoi16’s original code)
https://drive.google.com/file/d/1eD669brBcudl5Q2VZoNaEO2T5jFkVx4F/view?usp=sharing