Midterm
Exam, CS130
Name________________
Grade__________ Student
ID____________
Instructions. The exam is just one programming exercise, similar
to the labs you have done except that you will not get step-by-step
instructions. The exam is open book--you
may use any books or notes, the course web site, your past work, etc. Communicating with other people is illegal—so
no conversations, instant messaging, chat rooms, or email, even if you have
finished the exam already. You may
use the Internet only to reach the course web site. Call your project Midterm1. Make your 4-digit student ID appear in the
title bar of your program. If the number
does not appear in the title bar of your program you will lose one letter
grade.
You will have sixty minutes. You can submit your exam online in the same way that you usually submit your programming assignments. The server will record the time of submission. Submissions received more than 65 minutes after the start time will be docked one letter grade. Submissions received more than 68 minutes after the start time will receive an F. If the server is overloaded between 60 and 65 minutes—well, the exam was due after 60 minutes, not 65. Of course, if there are serious technical difficulties affecting many people, adjustments will be made.
The
problem requirements.
1. Your program should have a Color menu
offering options Red, Blue, and Yellow, and two menus Circle
Size and Square Size, each offering options
2. When the user left-clicks the mouse, a
circle is drawn, centered at the point where the user clicked.
3. When the user right-clicks the mouse, a
square is drawn, centered at the point where the user clicked.
4. When the program first opens, a solid “small”
red circle is drawn in the center of the window. (You choose what the meaning of “small”,
“medium”, and “large” will be—just pick three different numbers in increasing
order. These numbers will serve for the
diameter of the circles and the side of the squares.
5. There will never be more than one square and
never more than one circle. When you
create a new square, the old one (if any) disappears. When you create a new circle, the old one
(if any) disappears.
6. The Circle Size and Square Size menus work to change the size of the currently visible
circle or square. The next circle or
square drawn will use the new size, too.
The square and circle sizes are independent, i.e. choosing a new circle
size does not affect the square size.
7. By contrast the Color menu does not
affect the color of the current circle and square. It does, however, affect the color of the next circle or square to be drawn.
4. For
the diameter of the circle or the side of the square, use 40 + the last two digits of your student
ID. Example: if your student ID is 2345, use 85.
4. Anything that was previously on the screen
disappears when a new drawing is made; only the most recent figure shows.
5. When the window is resized, the drawing does
not disappear. It remains in the same
place relative to the upper left corner of the window.
6. The menu works to allow the user to change
the shape and color. When a menu choice
is made, the currently visible drawing changes to the newly specified shape and
color. The next mouse click will also
use the new shape and color.
1. 10 points if the menu appears
2. 10 points if a circle appears when the
program opens
3. 10 more points if the circle is centered in
the window.
4. 10 more points if the circle is red
5. 10 more points if the drawing remains (and
in the same place) when the window is resized.
6. 10 more points if the menu changes the
shape (5 pts) and color (5 pts) correctly
7. 10 more points if a mouse click causes a
new drawing
8. 10 more points if the new drawing remains when the window is
resized.
9. 10
more points if the new drawing is in the correct shape and color
10. 10 more points if the old drawing correctly
disappears when the mouse is clicked.