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

ارجو المساعده في شرح السؤال !

بدأه دراسات معلومات في 14 أكتوبر 2011 · 3 رد · 426 مشاهدة · في الأسئلة المجابة
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

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

ارجو شرح السؤال!!

Write a class named Car that has the following member variables:

yearModel, make, speed. In addition the class should have the following

constructor and the other member functions

constructor-accept the cars year model make as arguments. an assign to

the objects year, make also assign speed 0 to speed member.

Accessors to get the values stored in an object's yearModel make, speed

accelerate- should add 5 to the speed member variable each time it is

called.

brake- subtract 5 from speed each time it is called.

Demonstrate the class in a program that creates a Car object and then

calls the accelerate function five times. After each call to the accelerate

function get the current speed of the car and display it. Then call the brake

function five times after each call to the brake fuction, get the current

speed. of the car and display it.

تم تعديل هذه المشاركة بواسطة دراسات معلومات في 14 أكتوبر 2011 في 20:56

#2

؟؟؟؟؟؟؟؟؟؟

6 مشاهدات ولارد

انا مابغى الحل بس ابغى شرح للسؤال ضروري :(

#3

المطلوب : عمل كلاس Car يمثل سيارة بحيث يكون داخل هذا الكلاس متغيرات yearModel, Make, Speed

كذلك يحتوي الكلاس على باني constructor وهذا الباني يستقبل المتغير yearModel كمتغير بحيث يتم اسناد قيمة هذا المتغير الى المتغير yearModel الخاص بالكلاس

وكذلك اجعل قيمة المتغير speed الابتدائية هي صفر

ايضا قم باضافة دوال accessors المقصود دوال (set/get) للمتغيرات yearModel, Make, Speed

واضف ايضا الدالة accelerate للتعجيل بحيث يتم اضافة 5 للمتغير speed في كل مره تستدعي فيها هذه الداله

والداله brake التي تقوم بعكس الداله السابقه بحيث تقوم بطرح 5 من قيمة المتغير speed

قم بتوضيح عمل هذ الكلاس من خلال عمل اوبجكت من النوع car

قم باستدعاء الداله accelerate خمس مرات بحيث تقوم بعرض قيمة السرعه في كل مره تستدعي فيها الداله

وبنفس الطريقه قم باستدعاء الداله brake خمس مرات بحيث تقوم بعرض قيمة السرعه في كل مره تستدعي فيها الداله

1

No intellectual battle was ever won through retreat
You do not watch Gintama? Dude, you are missing a lot!


صورةmsrgb1485.gif ocajavase7programmerclr.gif

#4

شكرا :)

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