horsemanship世界

星期四, 3月 02, 2006

Homework2

public class work
{
public static void main (String[] args)
{
int weight1;
double weight2=6.181818181818;
double c=0.0175;
double Rmet=10;
double Bmet=8;
double Smet=1;
double calories;
double w,x,y,z;
w=c*weight2*10*30; x=c*weight2*8*30;
y=c*weight2*6*60; z=w+x+y;
System.out.println("Person's weight=150 pound.");
System.out.println("SO,change into kg= 150/2.2 ="+weight2);
System.out.println("The person run 30 minutes,so he was burned "+w+" calories.");
System.out.println("He play basketball 30 minutes,so he was burned "+x+" calories.");
System.out.println("He sleep 6 hours,so he was burned "+y+" calories.");
System.out.println("The total he burned was "+z+" calories.");
}
}
結果:
Person's weight=150 pound.
SO,change into kg= 150/2.2 =6.181818181818
The person run 30 minutes,so he was burned 32.4545454545445 calories.
He play basketball 30 minutes,so he was burned 25.9636363636356 calories.
He sleep 6 hours,so he was burned 38.9454545454534 calories.
The total he burned was 97.3636363636335 calories.

0 Comments:

張貼留言

<< Home