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

اريد تقييمكم على البرنامج + شرح بسيط لبعض الفقرات =)

بدأه CCSI في 1 أبريل 2009 · 2 رد · 411 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

السلام عليكــم ورحمـة الله وبركاتــه ،،

  • Write a Mobile class, which contains three attributes: colour, make, and model.
    • All attributes should be represented as strings.
    • The model and make of a mobile are not modifiable
    • All mobiles are made by Nokia (i.e. the make is the same for all mobiles)

  • Write a constructor for the class.
    • If you were not able to write a default constructor, what do you think is the reason for this inability?
    • Are there any attributes that cannot be initialized inside the constructor? What are they?

  • Add three methods (member functions) to the class:
    • First method should be called ring which displays on the screen "ring! ring! ring!". This method should not change any of the attributes values.

    • Second method prints on the screen the mobile's description (colour, make and model of the mobile.)

    • Last method is called changeCover, which sets the colour of the mobile to a given colour.

  • Add another method (member function) called isTheSame which takes a Mobile object as a parameter. It should return true if the given Mobile object is the same as this mobile. Two mobiles are the same if they have the same make and model.

  • Test your class by creating a silver, Nokia, 6600 mobile object. Then send it a message to display its information.

Change the cover of the mobile to a red one, then again send it a message to display its information.

Create another black, Nokia, 3310 mobile object, then ask it if it was the same as the first mobile (the one you have created above).

  • Change the isTheSame method in question 4 to be a global function that is a friend of the class.
    • Do you need to change the parameters and why?
    • Change the test case in question 5 to reflect the modification of the function.

أريد شرح الفقرة الرابعة مشكورين =)

الذي فهمته من هذه الفقرة يريد ان انشأ دالة وارسل لها كائن من المين

وداخل الدالة انشأ شرط اذا كان الكائن المرسل نفس الـمواصفات بس ما فهمت مواصفات ايش !! :blink: اذا الشرط صحيح ارجع قيمة صحيحة واذا خطأ ارجع قيمة خاطئة

هل فهمي للسؤال صحيح !! شكرا للجميعـ :blush: ـ

رْبَِ أِشًرح لِــِّي صِدرِيَِ وُيسَّرَِّ لّْي أِםـَـرًيِ ~

--۰•ஐ--------------❤---

#2

السلام عليكم

فهمك صحيح للفقره , الداله تكون بالشكل الآتى

 bool isTheSame(Mobile & M)
{
if(make == M.make && model == M.model) return true;
else
return false;
}

اللهم صل على سيدنا محمد وعلى آله وصحبه وسلم

#3

الله يجزاك خير ياربِ :happy:

شكرا لجهودك

دمتم بخير =)

رْبَِ أِشًرح لِــِّي صِدرِيَِ وُيسَّرَِّ لّْي أِםـَـرًيِ ~

--۰•ஐ--------------❤---

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

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

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

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

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