Java Reference
In-Depth Information
The number of calories burned per minute may be estimated using the formula:
Calories/Minute = 0.0175
×
×
Weight(Kg)
Write a program that calculates and outputs the total number of calories burned
for a 150-pound person who runs 6 MPH for 30 minutes, plays basketball for 30
minutes, and then sleeps for 6 hours. One kilogram is equal to 2.2 pounds.
MET
2.
The video game machines at your local arcade output coupons according to how
well you play the game. You can redeem 10 coupons for a candy bar or 3 cou-
pons for a gumball. You prefer candy bars to gumballs. Write a program that
defines a variable initially assigned to the number of coupons you win. Next, the
program should output how many candy bars and gumballs you can get if you
spend all of your coupons on candy bars first, and any remaining coupons on
gumballs.
3.
Write a program that starts with the string variable first set to your first name
and the string variable last set to your last name. Both names should be all
lowercase. Your program should then create a new string that contains your full
name in pig latin with the first letter capitalized for the first and last name. Use
only the pig latin rule of moving the first letter to the end of the word and add-
ing “ay”. Output the pig latin name to the screen. Use the substring and
toUpperCase methods to construct the new name.
For example, given
first = "walt";
last = "savitch";
the program should create a new string with the text “Altway Avitchsay” and
print it.
4.
A government research lab has concluded that an artificial sweetener commonly
used in diet soda pop will cause death in laboratory mice. A friend of yours is
desperate to lose weight but cannot give up soda pop. Your friend wants to know
how much diet soda pop it is possible to drink without dying as a result. Write a
program to supply the answer. The program has no input but does have defined
constants for the following items: the amount of artificial sweetener needed to
kill a mouse, the weight of the mouse, the starting weight of the dieter, and the
desired weight of the dieter. To ensure the safety of your friend, be sure the pro-
gram uses the weight at which the dieter will stop dieting, rather than the dieter's
current weight, to calculate how much soda pop the dieter can safely drink. You
may use any reasonable values for these defined constants. Assume that diet soda
contains 1/10th of one percent artificial sweetener. Use another named constant
for this fraction. You may want to express the percent as the double value 0.001 .
(If your program turns out not to use a defined constant, you may remove that
defined constant from your program.)
Search WWH ::




Custom Search