الموضوع: lab sheet 6
عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 15-12-2011, 03:04 AM   #14

ميشو كوول

جامعي

 
تاريخ التسجيل: Oct 2011
نوع الدراسة: إنتظام
الجنس: أنثى
المشاركات: 5
افتراضي رد: lab sheet 6

السلام عليكم
الله يجزاك الف خير
بس ممكن تحل هذي السؤالين >
1. Write method distance to calculate the distance between two points (x1, y1) and (x2, y2). All numbers and return values should be of type double. Incorporate this method into an application that enables the user to enter the coordinates of the points.

Hints:
• The distance between two points can be calculated by taking the square root of
( x2 - x1 )2 + ( y2 - y1 )2
• Use Math class methods to compute the distance.
• Your output should appear as follows
ويطلع االاوت بوت
Type the end-of-file indicator to terminate
On UNIX/Linux/Mac OS X type <ctrl> d then press Enter
On Windows type <ctrl> z then press Enter
Or Enter X1: 1
Enter Y1: 1
Enter X2: 4
Enter Y2: 5
Distance is 5.000000
Type the end-of-file indicator to terminate
On UNIX/Linux/Mac OS X type <ctrl> d then press Enter
On Windows type <ctrl> z then press Enter
Or Enter X1: ^Z
السؤال الثاني
2. Write an application that prompts the user for the radius of a circle and uses a method called circleArea to calculate the area of the circle.
Hints:
• Use the constant Math.PI in the area calculation.
• This application should be similar to the one in Coding Exercise 6.
• Your output should appear as follows:


Enter the radius (negative to quit): 10
Area is 314.159265
Enter the radius (negative to quit): -1
وشكرا
والله ماتتصور قد ايش دعيتلك مع الفجر
هالواجبات مالها داعي مع الاختبارات

 

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