عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 03-05-2012, 09:05 PM   #4

sweeeeeeeeeeeeeeet

جامعي

الصورة الرمزية sweeeeeeeeeeeeeeet

 
تاريخ التسجيل: 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);
}

}

دعواتك

 

sweeeeeeeeeeeeeeet غير متواجد حالياً   رد مع اقتباس