الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

للضروره القصوى جداً + أرجوا أن تساعدوني + الله يخليكم

مغلق
بدأه البرنس وليد في 23 مارس 2003 · 1 رد · 587 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

يا شباب أنا عندي واجب جافا ممكن تحلونه لي بسرعه الليله أرجوكم .

Programming II (ITBP220)

Spring 2003

Programming Assignment # 2

Submission Deadline: March 24, 2003

1.

Write a program to input two positive integer values and then print all prime numbers between the two values (inclusive). Prime numbers are divisible only by 1 and itself. The program should contain the following two methods in addition to the main method:

void printPrimes(int a, int B){/* provide code for the body */}

boolean prime(int n){/* provide code for the body */}

printPrimes method will be called by the main method to print all prime numbers between the two argument values a and b (aB). prime method will be called by the printPrimes method to find whether a number is prime or not. So printPrimes is a helper method for the main and prime is a helper method for the printPrimes.

2.

Update the program to handle the following cases.

1) If any of the input value is not a positive integer, print an error message and terminate the program.

2) It the first input value is greater than the second, swap the two values before calling printPrimes, so that the first argument of the printPrimes is not greater than the first one.

3) If there is no prime number between the two input values, print the message "There is no prime number between the two values." (You will need to use a counter in the printPrimes method. If the counter value is zero, you print the message.)

Submit only one program after doing both parts of the assignment.

#2

:rolleyes:

أحمد ..

هذا الموضوع مغلق.

مواضيع مشابهة

عدد الزوار حالياً

المتواجدون خلال آخر دقيقتين · يتحدّث كل ٣٠ ثانية

—الإجمالي—أعضاء مسجّلون—زوار بدون تسجيل

جارٍ التحقق من المتواجدين…