All work must be submitted by 10pm on Friday, Sep 2. Late work will be accepted until 10am on the following Monday with a 10 point late penalty. After that, your only way to submit is by using one of your two very late submissions for the semester (which will be due by 11:59pm on the following Wednesday). Submit the programming work online to http://culearn.colorado.edu, following the instructions at www.portmain.com/intro/submit.html.
You may talk with other students and instructors about the assignments, but you may not look at or copy code written by others. The penalty for violating this code is an F for the entire semester.
Write a program that opens a graphics window and draws five equilateral triangles. The triangles must be fairly small and at the positions of the five brightest stars in the constellation Canis Major (the "Dog"):
Each triangle must be drawn with three distinct lines; it must be an equilateral triangle in this orientation:
Of course, in winbgim, your triangles will be white lines on a black background. The sizes of the triangles should decrease in this order: Sirius (the biggest), Adhara, Beta (β), Delta(δ), and Eta(η). No triangle should be bigger than about 28 pixels from top to bottom.
After drawing the triangles, the program must pause for two seconds and then draw the same triangles in the same spots on the screen, but this time they will be flipped upside down (with the peak pointing down). Then the program pauses for 20 seconds and ends.
Don't leave it until the last moment in case you have trouble figuring out how to submit to CULearn.
const int X3 = int(0.05*S);Or you could use the expression int(0.05*S) directly in your main program. The decision is up to you!
The implementation of the funtion will call the WinBGIm line function three times. You'll need to use some trigonometry to figure out the (x,y) coordinates of the endpoints of the three lines that it draws. For example, the x-coordinate of the peak point is given by this formula:
center_x + radius*cos(peak_angle)where peak_angle is the name of your parameter that indicates the angle of the peak. The formula gives a double number, so you'll get a warning from the compiler (because the line function expects an int). Don't worry about that for now. (Later, we'll see how to avoid such warnings!)