![]() |
Write an applet that displays a picture of a
stoplight. The stoplight should be centered within the applet and
the size of each of its lights should be one-fourth that of the
appletĘs standard size 400x400. The top circle should be red, the
center circle should be yellow, and the bottom circle should be
green. Finally, a white rectangle should surround the three circles
exactly. |
![]() |
Write an applet that displays a pie chart showing the percentages of
students of each class taking this course. The pie chart should be centered within the applet and
its size should be that of the
appletĘs standard size 400x400. The pie should be divided
according to the following percentages:
The individual wedges should be colored accordingly:
|
BMI = (weight in kilograms) / (height in meters)2
An index of 27.8 or greater for men or 27.3 or greater for non-pregnant women is considered obese. Write java code that, given height and weight in metric units, determines the BMI.
public Applet () { double weightKG = 100.0; double heightM = 2.1;// enter Java code here to calculate BMI }
Now write your code such that the height and weight can be calculated given American units. Note that one meter is 39.37 inches, one inch is 2.54 centimeters, one kilogram is 2.2 pounds, and one pound is 454 grams.
public Applet () { double weightLB = 220.0; double heightF = 6.1;// enter Java code here to calculate BMI }