- Read the rules for this exam.
- Implement and test a new project called Exam2 that implements this UML class diagram, Stage 1.
Grading rubric — 10 points, as follows: 5 points if the tool tips work, 5 points if everything else works.
But no points if you do not follow the UML class diagram, Stage 1.
- Implement and test the addition of a single LightGrayButton to the CyanPanel as described in this UML class diagram, Stage 2.
- Per the UML, pressing the button once should change its text to "2". Pressing it again should change its text to "3". And so forth.
- A LightGrayButton should be LIGHT_GRAY.
Grading rubric — 15 points, as follows: 3 points if the button appears as specified, 12 points if it acts as specified.
But no points if you do not follow the UML class diagram, Stage 2.
- Revise your project so that:
- Instead of a single LightGrayButton,
the CyanPanel displays 100 LightGrayButton's
(each of which acts just like the LightGrayButton described in the previous problem).
-
Furthermore,
clicking the mouse anywhere in the CyanPanel (except on a button) should reset the text to "1"
for ALL the buttons on the CyanPanel.
- Here is what your project should look like
after completing this problem (after the user presses several of the buttons several times).
- Here is what your project should look like
after completing this problem (immediately after the user clicks the mouse on the CyanPanel).
Grading rubric — 25 points, as follows:
10 points if clicking the mouse resets at least one of the buttons to "1",
15 more points if clicking the mouse resets ALL of the buttons on the CyanPanel to "1".
- Also, reduced score if you do not follow the UML class diagram, Stage 3.
- Good style demands that changing the number of buttons from 100 to something else should mean changing ONE number in the program.
- Good style demands that here you use an ArrayList instead of an array.
- Good style demands that any ArrayList you use be parameterized (ie.. uses the angle-bracket notation) appropriately.
- Implement and test the following (partial credit is available):
- A WhiteButton class as described in this UML class diagram, Stage 4.
- Add a new LightGrayButton to the YellowPanel.
- Add a new WhiteButton to the CyanPanel.
- The WhiteButton in the CyanPanel has-a the sole LightGrayButton in the YellowPanel.
- Pressing the WhiteButton in the CyanPanel does ALL of the following:
- It increments its own number.
- It changes the background color of the CyanPanel to PINK. (Don't bother to change the Tool Tip.)
- It changes the background color of the YellowPanel to BLUE. (Don't bother to change the Tool Tip.)
- It increments the number on the sole LightGrayButton in the YellowPanel.
- A WhiteButton should be WHITE.
Here is what your project should look like
after completing this problem (after the user presses the WhiteButton and various LightGrayButtons, including the one on the YellowPanel).
The new part of the UML for this stage is shown in gray in that diagram.
Grading rubric — 30 points, as follows:
- 10 points if pressing the WhiteButton increments its own number (but NO points if this is NOT through inheritance)
- 5 points if pressing the WhiteButton changes the background color of the CyanPanel to PINK.
- 5 points if pressing the WhiteButton changes the background color of the YellowPanel to BLUE.
- 10 points if pressing the WhiteButton increments the number on the sole LightGrayButton in the YellowPanel (but no points if not through a direct has-a relationship).
- Implement and test the addition of a single JButton to the YellowPanel,
where the JButton responds to itself via an anonymous class
by decrementing its number.
- Make the JButton be ORANGE, so that I can easily tell which one it is.
- The new part of the UML for this stage (Stage 5) is shown in gray in that diagram.
Here is what your project should look like
after completing this problem (after the user presses the orange JButton several times).
Grading rubric — 10 points, as follows: 10 points if the button responds to itself successfully via an anonymous class, else no credit.
- Implement and test the addition of a single PinkButton to the YellowPanel as described in this UML class diagram, Stage 6.
- Per the UML, the number on the PinkButton should start at 1 and increase by 1 every second (approximately) by itself.
- Pressing the PinkButton should have no effect.
- A PinkButton should be PINK.
- The new part of the UML for this stage is shown in gray in that diagram.
- Here is what your project should look like
after completing this problem (after the program has run for about 10 seconds).
Grading rubric — 10 points if the PinkButton behaves as specified.
- Turn in your work by committing your Exam2 project to your individual repository: