Homework Level: Jurassic Park Kid, for Grade C
1. Graphical Quiz
Write a program that shows a picture of something from your field of study or something you are interested in and have the user click on at least three items to identify. For example, if you are a biology student, you might show a picture of the brain and ask the user to identify the Cerebellum, Wernicke's area, and Broca's area. In my case, as a computer guy, I might put up a picture of a computer and have the user identify memory, the power supply, and the CPU:
Add a label to display the user's score. The score should increase by one each time the user correctly clicks on one of the items. The score should not increase if the same item is clicked more than once. Quit (with the code this.Close(); ) when all items have been found.
Here is a sample program that illustrates the desired behavior; your program need not be identical but should have the same basic functionality: GraphicalQuiz.exe
2. Find the Secret Message
Steganography involves the hiding of secret messages
within something that appears innocuous. The following image contains such a
Although every pixel in the image looks green, some of them have been altered. The altered pixels are colored (R=5, G=64, B=5) while the other pixels are colored (R=0, G=64, B= 0). This slight difference is too small for people to distinguish so it looks like everything is one color. Write a program to reveal the secret message by changing the color of the altered pixels. Your program must use a while loop. What is the secret message?
3. Red-Eye Reduction
The following image is from an article by HP Labs, entitled "Beyond Film" at http://www.hpl.hp.com/news/2004/apr-jun/beyond_film.html . The article discusses techniques for automatic red-eye reduction from photographs.
To save this image on your disk, right-click the image and select "Save As". You can then load the image into a PictureBox so that you can process it.
Write a program that finds the red pixels in each eye and sets the red component to the average of the green and the blue components. This turns the red pixel into a corresponding shade of gray. For example, if a pixel is (R=160, G=20, B=30), then the red component should be set to (20+30)/2 or 25. The pixel should then be changed into (R=25, G=20, B=30).
The pixels that you should change are any pixels where the red component is at least 30 higher than the green and at least 30 higher than the blue. For example, the pixel (R=50, G=30, B=30) should be left unchanged because the red component is only 20 larger than the green and blue. However, (R=100, G=10, B=20) would get changed to (R=15, G=10, B=20).
If you change every pixel in the image according to this rule then most of the fleshtones and the lips of the subject would also be changed to gray. Therefore, you should process pixels in the region around the red eyes. To help you out, here are the coordinates of rectangles that capture each eye. Your program only needs to process pixels within the inside of these rectangles.
Your program must use for loops. Do not use while loops.
4. The Lazy Professor
Grading is hard work. Your professor has decided to randomly pick 3 students that will receive A's and the rest will receive C's. Every student in the class has a numeric ID that is numbered from 1 to N, where N is the number of students enrolled. Write a program that has a textbox for the lazy professor to enter the number of students enrolled, and a button that when clicked will randomly pick the 3 lucky students that will get A's. The program should output their ID numbers.
Your program should use a while loop to randomly pick the three students and ensure that the ID numbers selected are unique. In other words, if two or more numbers selected are the same then the program should randomly pick again until all three numbers are unique. If there are 3 or fewer students in the class then all of them should get A's.