星期三, 9月 28, 2005

LAB2


public class fat1
{
public static void main(String[] args)
{
double m_weight=6;
double m_lost_weight=0.5;
double m_sodapop=200;
double m_can_sodapop=600;
double original_weight=70;
double ideal_weight=60;
double b=m_can_sodapop*(original_weight/m_weight);

System.out.println( "we know" );
System.out.println( "The weight of the fat mouse is " +m_weight+ "kg" );
System.out.println( "When the fat mouse drink " +m_sodapop+ " c.c => he can lost "+m_lost_weight+ " kg " );
System.out.println( "When the mouse drink " +m_can_sodapop+ " c.c => he will die" );
System.out.println( "***** When people *****" );
System.out.println( "If Marry is " +original_weight+ "kg " );
System.out.println( "Her ideal weight is " +ideal_weight+ "kg " );
System.out.print( "She can drink:" );
System.out.println( " " +m_can_sodapop+"*(" +original_weight+ "/" +m_weight +")="+b+ "c.c" );
System.out.println( "She will lose=>" +m_lost_weight+ "*" +b+ "/" +m_sodapop+ "="+m_lost_weight*b/m_sodapop+ "kg" );
}
}

0 Comments:

張貼留言

<< Home