03-05-2012, 09:05 PM
|
#4
|
تاريخ التسجيل: Apr 2009
التخصص: IT ^ـ^
نوع الدراسة: إنتظام
المستوى: متخرج
الجنس: أنثى
المشاركات: 124
|
رد: مساعدة عاجلة في البرمجة
import java.util.Scanner;
public class ball {
publicstaticvoid main(String args []){
System.out.println("Enter the initial velocity of the ball: ");
Scanner scan= new Scanner(System.in);
int velocity= scan.nextInt();
int bounces=0 ;
double height=0.0 ;
while(bounces < 11){
if( bounces==0)
System.out.println("time "+bounces+"height "+height);
height += velocity;
velocity -= 32;
bounces++;
System.out.println("time "+bounces+"height "+height);
if (height <= 0){
height *= -0.5;
velocity *= -0.5;
bounces++;
System.out.println("time"+bounces+"height"+height);
}
}
دعواتك
|
|
|
|
|