عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 04-11-2012, 08:00 AM   #491

saberelmasry

جامعي

 
تاريخ التسجيل: Nov 2012
نوع الدراسة: ثانوي
الجنس: ذكر
المشاركات: 1
افتراضي ما شاء الله تبارك الله ربنا يوفقكم تكفون ابي حل لسؤال ما قدرت احله

write a Java program that will convert an input metric to a corresponding value in the International System of Units. Input metric will be in Yards, Inches, Miles, and Pounds. The converted metric should be converted as follows





The user has to enter c, m, k, or g. Next, the user will enter a value for the input metric which the program will convert to the specified unit from table 1. The output of the program should be the converted metric value. In addition, consider the following scenarios in the output:
1. If the user inputs a character that is not recognized (NOT c, m, k, or g), then the program prints “Wrong Selection!”, and exits.
2. If the user inputs a value less than zero for a metric, the program will display a message that states “Cannot convert a negative value!
3. After displaying the converted metric value (if input value is not negative), the program should also display the range of the converted value according to the following rules:
a. If converted value is less than 20, print “Less than 20.”
b. If converted value is less than 50, print “Less than 50.”
c. If converted value is equal 50, print “Equal 50”.
d. If converted value is greater than 50, print “Greater than 50.”

 


التعديل الأخير تم بواسطة saberelmasry ; 04-11-2012 الساعة 08:02 AM.
saberelmasry غير متواجد حالياً   رد مع اقتباس