Java Reference
In-Depth Information
PP 3.6
Write an application that reads the lengths of the sides of a trian-
gle from the user. Compute the area of the triangle using Heron's
formula (below), in which s represents half of the perimeter of
the triangle and a , b , and c represent the lengths of the three
sides. Print the area to three decimal places.
ss a s b s c
(
)( -)( -)
Area
=
-
PP 3.7
Write an application that generates a random integer in the range
20 to 40, inclusive, and displays the sine, cosine, and tangent of
that number.
PP 3.8
Write an application that generates a random integer radius (r)
and height (h) for a cylinder in the range 1 to 10, inclusive, and
then computes the volume and surface area of the cylinder.
r 2 h
Volume
=
p
Area
=
2
rh
p
PP 3.9 Write an application that displays a frame containing two labels
that display your name, one for your first name and one for your
last. Experiment with the size of the window to see the labels
change their orientation to each other.
PP 3.10 Write an application that displays a frame containing two panels.
Each panel should contain two images (use four unique images—
your choice). Fix the size of the first panel so that both of its
images remain side by side. Allow the other panel to change size
as needed. Experiment with the size of the window to see the
images change orientation. Make sure you understand why the
application behaves as it does.
PP 3.11 Modify the LabelDemo program so that it displays a fourth label,
with the text of the label centered above the image.
 
Search WWH ::




Custom Search