Java Reference
In-Depth Information
*14.11
( Paint a smiley face ) Write a program that paints a smiley face, as shown in
Figure 14.46a.
(a)
(b)
(c)
F IGURE 14.46
(a) Exercise 14.11 paints a smiley face. (b) Exercise 14.12 paints a bar chart. (c) Exercise 14.13 paints a
pie chart.
**14.12
( Display a bar chart ) Write a program that uses a bar chart to display the percent-
ages of the overall grade represented by projects, quizzes, midterm exams, and the
final exam, as shown in Figure 14.46b. Suppose that projects take 20 percent and
are displayed in red, quizzes take 10 percent and are displayed in blue, midterm
exams take 30 percent and are displayed in green, and the final exam takes 40
percent and is displayed in orange. Use the Rectangle class to display the bars.
Interested readers may explore the JavaFX BarChart class for further study.
VideoNote
Display a bar chart
**14.13
( Display a pie chart ) Write a program that uses a pie chart to display the percent-
ages of the overall grade represented by projects, quizzes, midterm exams, and
the final exam, as shown in Figure 14.46c. Suppose that projects take 20 percent
and are displayed in red, quizzes take 10 percent and are displayed in blue,
midterm exams take 30 percent and are displayed in green, and the final exam
takes 40 percent and is displayed in orange. Use the Arc class to display the pies.
Interested readers may explore the JavaFX PieChart class for further study.
14.14
( Display a rectanguloid ) Write a program that displays a rectanguloid, as shown
in Figure  14.47a. The cube should grow and shrink as the window grows or
shrinks.
(a)
(b)
(c)
F IGURE 14.47
(a) Exercise 14.14 paints a rectanguloid. (b) Exercise 14.15 paints a STOP
sign. (c) Exercise 14.13 paints a grid.
*14.15
( Display a STOP sign ) Write a program that displays a STOP sign, as shown
in Figure 14.47b. The octagon is in red and the sign is in white. ( Hint : Place an
octagon and a text in a stack pane.)
 
 
Search WWH ::




Custom Search